Elephants main component is its' allocator. The allocator can be used to replace all or part of the default system allocator, depending on your needs. The advanced features enable you to intricately see every memory operation performed and detect potential problems before they arise.
The allocator will run on any platform and is deterministic when certain conditions are met. If you perform the same operations on one platform, the memory structure will be identical on another.
Whether you just want to replace the system malloc/new or if you have a more complex allocation scheme for each area of your application, Elephant will allow you to do that quickly and easily.
Elephant features many things:
- 32bit and 64bit.
- Support for heaps which can work in other areas of memory like VRAM or special system memory areas, to improve performance on the platforms that allow it.
- Intrusive and Non Intrusive Heaps
- Fixed size Pool allocators
- Multiple levels of debugging support: give a name to each allocation if needed or track a single allocation.
- Multiple levels of error tracking: track memory overruns at multiple levels with minimal performance impact.
- Small memory heap: diverts small allocations to another heap to prevent fragmentation.
- Fast: it's designed for all applications.
- Simple API makes it easy to integrate and use.
- Default 16 byte alignment up to any power of two alignment you wish.
- And much more.
Performance And Fragmentation
Elephant is not only fast, as shown by the tests, but it also competes on fragmentation performance too. With Elephant, you can also use Pools in your application. This can potentially reduce any fragmentation issues to far lower than typically observed with standard allocation systems alone.
Elephant divides your memory up into one or multiple Heaps which may be created dynamically based on the needs of your application. Each Heap allows for variable size allocations with variable alignment properties. A Heap can also operate on other areas of memory that, typically are not managed, like VRAM.
Each Heap is fully customisable; with over 15 separate customisations available. These include default alignment, minimum allocation size and similar settings. You can also lock a Heap to prevent memory operations or to prevent misuse.
In addition to Heaps, Pools allow for very fast fixed size allocations with minimal, often zero overhead. Elephant provides a couple of Pool variants depending on your needs.
Pools can help reduce some fragmentation problems that can sometimes arise with small, long-term allocations.
Error Checking And Debugging
All Heap memory operations (and some Pool types) allow every allocation or free to be associated with name and callstack information at a small overhead cost. More than 20 different types of errors are detected including multiple free and invalid addresses. All of which can cause catastrophic errors in traditional allocators.
Elephant also comes with the ability to track memory corruption caused by buffer under/overruns and dangling pointers. All of which is done without interrupting your work flow. You can even get Elephant to warn you when a specific allocation (or free) occurs at a memory address or on a unique id.