C/C++ Memory Allocator

Released 3 years ago , Last update 3 years ago

C/C++ block memory allocator with optimization and debugging features.

C/C++ block memory allocator provides applications with internal memory allocation and debugging capabilities. It is an optimized memory allocator which provides capabilities for detecting common memory allocation and deallocation errors. Useful for applications that require block memory allocation.

Block memory allocation refers to allocators that allocate pools of memory up front so as to reduce allocation times. This allocator can be tweaked to provide custom pools for memory sizes used by a given application.

Features:

  • Provides class C malloc interface and C++ operator new interface.
  • Provides an internal per thread memory pool.
  • Thread safe and optimized for performance.
  • Allocator can be customized for specific needs (i.e: The allocator can be optimized to allocate fixed sized memory blocks of a specific size.)

Pricing

14 day 14-day money-back guarantee

FREE

GNU LGPL

The GNU LGPL is an open-source license.

$429.99

Developer License

  • Perpetual license

  • Unlimited projects

  • Can distribute code and binary products

  • Commercial use

  • 6 months support

Documentation

Block allocator

The system provides an interface to a low-level block memory allocator. The block memory allocator provides methods to allocate and deallocate memory of specific fixed sized blocks.

Additionally, the system can tell if an address was allocated by it. This is useful for determining if memory was indeed allocated by Mem Block and whether or not it was released. The underlying block memory allocator can continuously allocate memory as required.

It provides a method for determining memory usage providing the user with statistics regarding the number of used and free blocks. In addition to a generic fixed block memory allocator, the system provides customized int and double memory allocators for allocating fixed blocks of integers and double floating point types.

C interface

The higher level interfaces to Mem Block provide C memory allocation routines such as malloc, realloc, calloc, and free. These interfaces are built upon the low-level block allocator. They behave in a similar manner to the application code as the built-in allocators. The exception being that they are optimized.

C++ interface

At the highest level are the C++ interfaces to operator new and operator delete. These are implemented by Mem Block and provide optimized memory allocation for application code.

In order to utilize Mem Block in Object Oriented code, the user includes the special header file mem_block_new.h within a given class declaration. That class then has new and delete declared for it, and can begin using Mem Block's interface for memory allocation and deallocation.

Debugging

Mem Block provides debugging functionality when compiled with memory debugging enabled. The check_memory() function checks the fragmentation of the allocator.

Additionally, there are checks for common memory problems such as double free, where a pointer is freed more than once. The system can also check for free of NULL pointer or a free on a pointer that was not allocated by Mem Block. Furthermore, Mem Block provides an ability for checking if a write occurs outside of bounds.

Optimization

Mem Block provides an ability for the allocator to be calibrated based on the size of blocks that the allocator will be providing. The system does this by allowing the user to run the allocator with debugging turned on, and a special method called show_map() is called to generate a map of the sizes that the allocator was requested to allocate.

The sizes can then be given to the allocator on startup to allow it to configure itself for optimized memory allocation for the sizes the application code requires. The user may specify a custom map instructing the allocator on how to optimize its allocations.

Setup / installation

Compiling:

  • Unzip the file and then change directory to 1.0/mem_block directory.
  • Select the makefile you wish to use to build the code. You have the choice of using either Linux or MinGW on Windows to compile.
  • Depending on your platform type make -f Makefile.linux or make -f Makefile.win32.

On Windows this will build the thirdparty lib (libplatform.a) and the memblock lib (libmemblock.a) which will be deployed in the ../lib directory.

On Linux you will build the libmem_block.a library only as the platform library is just for portability on Windows.

You may then use the memory facility provided using the include file and link to this library.

Example usage

#include "mem_block.h"
using namespace mem_block;

int
main()
{
    // Example use.
    char *addr2 = (char *)bmalloc(10);
    bfree(addr2);
    return 0;
}

For more example usage, see memblocktest.cpp which can be built using make test.

3 licenses, starting from From » FREE View Licenses

Get A Quote

What do you need?
  • Custom development
  • Integration
  • Customization / Reskinning
  • Consultation
When do you need it?
  • Soon
  • Next week
  • Next month
  • Anytime

Thanks for getting in touch!

Your quote details have been received and we'll get back to you soon.


Or enter your name and Email
No comments have been posted yet.