Skip to content

A custom memory allocator based on FSA and Coalesce allocator.

License

Notifications You must be signed in to change notification settings

ArtemVetik/composite-memory-allocator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Composite Memory Allocator

About

A custom memory allocator based on Fixed Size Allocator (FSA) and Coalesce Allocator. The Composite Memory Allocator is a wrapper over these two allocators.

Basic allocation scheme, depending on the requested memory size:

  • [1B - 512B] — FSA is used. The Composite Memory Allocator contains several FSAs with different block sizes: 16, 32, 64, 128, 256, 512. The allocator with the minimum suitable size is selected.
  • [512B - 10 MB] — Coalesce Allocator is used.
  • [10M - ...] — VirtualAlloc is used directly.

Debug mode

Coalesce allocator in debug mode uses special markers inside service blocks and can track memory corruptions.

All allocators in debug mode can track memory leaks, double free, attempt to use uninitialized allocator.

Also Composite Memory Allocator in debug mode can output statistics on allocators and dump of occupied memory.

Usage example

CompositeMemoryAllocator allocator;  
allocator.init();  
void* p = allocator.alloc(1024);
// ...
allocator.free(p);    
allocator.destroy();

About

A custom memory allocator based on FSA and Coalesce allocator.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published