From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/Allocator/FixedHeapAllocator.h | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Runtime/Allocator/FixedHeapAllocator.h (limited to 'Runtime/Allocator/FixedHeapAllocator.h') diff --git a/Runtime/Allocator/FixedHeapAllocator.h b/Runtime/Allocator/FixedHeapAllocator.h new file mode 100644 index 0000000..1dc48b5 --- /dev/null +++ b/Runtime/Allocator/FixedHeapAllocator.h @@ -0,0 +1,31 @@ +#ifndef HEAP_ALLOCATOR_H_ +#define HEAP_ALLOCATOR_H_ + +#include "BaseAllocator.h" + +#define FIXED_HEAP_ALLOC_COUNT_USED !MASTER_BUILD + +class FixedHeapAllocator : public BaseAllocator +{ + void* m_TlsfPool; + void* m_pMemoryBase; + UInt32 m_nMemorySize; +#if FIXED_HEAP_ALLOC_COUNT_USED + UInt32 m_nSizeUsed; +#endif + +public: + FixedHeapAllocator(void* pMemoryBase, UInt32 nMemorySize, const char* name); + ~FixedHeapAllocator(); + + virtual void* Allocate (size_t size, int align); + virtual void* Reallocate (void* p, size_t size, size_t align); + virtual void Deallocate (void* p); + + virtual bool Contains (const void* p); + virtual bool CheckIntegrity(); + + virtual UInt32 GetPtrSize(void* p); +}; + +#endif -- cgit v1.1-26-g67d0