Public Types | |
enum | AllocationFlags { SizeInBytes = 0x00, SizeInPages = 0x01, SizeBitsMask = 0x0F, NoAlignment = 0x00, AlignOnPageSize = 0x10, AlignmentBitsMask = 0xF0 } |
These flags are passed to the constructor of the allocator. SizeInBytes is the default flag and gives an allocator that allocates blocks of the specified size in bytes. Size in pages causes the allocator to treat your block size as a multiple of the system's page size, so by specifying this flag and a block size of 1 you are asking for a block that is the size of the system't memory page. You can OR the AlignOnPageSize flag with the SizeInBytes or SizeInPages flag to tell the allocator that you want each block that is allocated to be aligned on a page boundary. More... | |
Public Member Functions | |
CSimpleFixedSizedMemoryAllocator (size_t blockSize, AllocationFlags allocationFlags=SizeInBytes) | |
Create an allocator for memory blocks of the requested size. See AlocationFlags for details of how you can tune the allocators allocation strategy. | |
CSimpleFixedSizedMemoryAllocator (const AllocationTuningParameters &tuningParams, size_t blockSize, AllocationFlags allocationFlags=SizeInBytes) | |
Create an allocator for memory blocks of the requested size using the supplied allocation tuning parameters. See AlocationFlags for details of how you can tune the allocators allocation strategy. | |
CSimpleFixedSizedMemoryAllocator (const CSimpleFixedSizedMemoryAllocator &rhs) | |
~CSimpleFixedSizedMemoryAllocator () override | |
Destroys the allocator, note that any blocks that are still allocated when the allocator is destroyed are no longer usable as the underlying memory will be released back to the operating system. | |
CSimpleFixedSizedMemoryAllocator & | operator= (const CSimpleFixedSizedMemoryAllocator &rhs) |
size_t | GetAllocationSize () const override |
Returns the size of the allocated blocks. | |
void * | Allocate () override |
Allocate a block of memory. | |
void | Free (void *pMem) override |
Release a block of memory back to the allocator for reuse. | |
Classes | |
struct | AllocationTuningParameters |
enum AllocationFlags |
These flags are passed to the constructor of the allocator. SizeInBytes is the default flag and gives an allocator that allocates blocks of the specified size in bytes. Size in pages causes the allocator to treat your block size as a multiple of the system's page size, so by specifying this flag and a block size of 1 you are asking for a block that is the size of the system't memory page. You can OR the AlignOnPageSize flag with the SizeInBytes or SizeInPages flag to tell the allocator that you want each block that is allocated to be aligned on a page boundary.
CSimpleFixedSizedMemoryAllocator | ( | size_t | blockSize, | |
AllocationFlags | allocationFlags = SizeInBytes | |||
) | [explicit] |
Create an allocator for memory blocks of the requested size. See AlocationFlags for details of how you can tune the allocators allocation strategy.
CSimpleFixedSizedMemoryAllocator | ( | const AllocationTuningParameters & | tuningParams, | |
size_t | blockSize, | |||
AllocationFlags | allocationFlags = SizeInBytes | |||
) |
Create an allocator for memory blocks of the requested size using the supplied allocation tuning parameters. See AlocationFlags for details of how you can tune the allocators allocation strategy.
CSimpleFixedSizedMemoryAllocator | ( | const CSimpleFixedSizedMemoryAllocator & | rhs | ) |
~CSimpleFixedSizedMemoryAllocator | ( | ) | [override] |
Destroys the allocator, note that any blocks that are still allocated when the allocator is destroyed are no longer usable as the underlying memory will be released back to the operating system.
CSimpleFixedSizedMemoryAllocator& operator= | ( | const CSimpleFixedSizedMemoryAllocator & | rhs | ) |
size_t GetAllocationSize | ( | ) | const [override, virtual] |
void * Allocate | ( | ) | [override, virtual] |
void Free | ( | void * | pMem | ) | [override, virtual] |