MemoryAllocator¶
MemoryAllocator
is an abstraction of memory allocators that TaskMemoryManager uses to allocate and release memory.
MemoryAllocator
creates the available MemoryAllocators to be available under the names HEAP and UNSAFE.
A MemoryAllocator to use is selected when MemoryManager
is created (based on MemoryMode).
Contract¶
Allocating Contiguous Block of Memory¶
MemoryBlock allocate(
long size)
Used when:
TaskMemoryManager
is requested to allocate a memory page
Releasing Memory¶
void free(
MemoryBlock memory)
Used when:
TaskMemoryManager
is requested to release a memory page and clean up all the allocated memory
Implementations¶
- HeapMemoryAllocator
- UnsafeMemoryAllocator