|
DelegateMQ
|
#include "Allocator.h"#include "xallocator.h"#include "predef/util/Fault.h"#include <cstring>#include <iostream>#include <mutex>#include <new>#include <cstddef>#include <cstdio>#include <assert.h>Macros | |
| #define | char_BIT 8 |
| #define | CHECK_ALIGNMENT |
| #define | MAX_ALLOCATORS 15 |
Functions | |
| template<class T > | |
| T | nexthigher (T k) |
| void | xalloc_init () |
| void | xalloc_destroy () |
| Allocator * | xallocator_get_allocator (size_t size) |
| void * | xmalloc (size_t size) |
| void | xfree (void *ptr) |
| void * | xrealloc (void *oldMem, size_t size) |
| void | xalloc_stats () |
| Output xallocator usage statistics. | |
| #define char_BIT 8 |
| #define CHECK_ALIGNMENT |
| #define MAX_ALLOCATORS 15 |
| T nexthigher | ( | T | k | ) |
Returns the next higher powers of two. For instance, pass in 12 and the value returned would be 16.
| [in] | k | - numeric value to compute the next higher power of two. |
| void xalloc_destroy | ( | ) |
Called one time when the application exits to cleanup any allocated memory. ~XallocInitDestroy destructor calls this function automatically.
| void xalloc_init | ( | ) |
This function must be called exactly one time before any other xallocator API is called. XallocInitDestroy constructor calls this function automatically.
| void xalloc_stats | ( | ) |
Output xallocator usage statistics.
Output allocator statistics to the standard output.
| Allocator * xallocator_get_allocator | ( | size_t | size | ) |
Get an Allocator instance based upon the client's requested block size. If a Allocator instance is not currently available to handle the size, then a new Allocator instance is create.
| [in] | size | - the client's requested block size. |
| void xfree | ( | void * | ptr | ) |
Frees a memory block previously allocated with xalloc. The blocks are returned to the fixed block allocator that originally created it.
| [in] | ptr | - a pointer to a block created with xalloc. |
| void * xmalloc | ( | size_t | size | ) |
Allocates a memory block of the requested size. The blocks are created from the fixed block allocators.
| [in] | size | - the client requested size of the block. |
| void * xrealloc | ( | void * | oldMem, |
| size_t | size ) |
Reallocates a memory block previously allocated with xalloc.
| [in] | ptr | - a pointer to a block created with xalloc. |
| [in] | size | - the client requested block size to create. |