Skip to content

AzCopey/ICMemory

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ICMemory

A collection of efficient memory allocators and pools. This provides four allocator types:

  • BuddyAllocator: A general allocator which efficiently handles external fragmentation by splitting blocks into "buddies". This is primarily for large allocations.
  • LinearAllocator: A very fast general allocator which allocates from a linear buffer, and deallocates the entire buffer when Reset() is called. This is primarily for large numbers of short lived allocations.
  • BlockAllocator: A very fast allocator for fixed sized blocks. This is primarily used by ObjectPool.
  • SmallObjectAllocator: A very fast allocator for small objects. This is similar to BlockAllocator but has several block sizes. This is primarily used for small objects that aren't suitable for pooling.

Paged versions of some of the allocators are also available, which scale the allocator size if it has run out of space.

For more information on the different allocator types, see the class documentation in the headers.

Usage

Allocating using the allocators is simply a case of using one of the various factory methods provided.

IC::LinearAllocator linearAllocator(1024);
auto allocated = IC::MakeUnique<int>(linearAllocator);

Allocating from a pool is just as simple:

IC::ObjectPool<int> objectPool(128);
auto allocated = objectPool.Create();

Links

About

A series of memory utilities, such as memory pools, for a C++11 application.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published