Heap.h 417 B

123456789101112131415161718192021222324252627282930313233
  1. #pragma once
  2. #include "../Common.h"
  3. NS_BF_BEGIN
  4. class ContiguousHeap
  5. {
  6. public:
  7. typedef int AllocRef;
  8. public:
  9. void* mMetadata;
  10. int mMemorySize;
  11. int mBlockDataOfs;
  12. Array<AllocRef> mFreeList;
  13. int mFreeIdx;
  14. public:
  15. ContiguousHeap();
  16. virtual ~ContiguousHeap();
  17. void Clear(int maxAllocSize = -1);
  18. AllocRef Alloc(int size);
  19. bool Free(AllocRef ref);
  20. void Validate();
  21. void DebugDump();
  22. };
  23. NS_BF_END