M4RI 1.0.1
|
The mmc memory management functions check a cache for re-usable unused memory before asking the system for it. More...
#include "misc.h"
Go to the source code of this file.
Data Structures | |
struct | _mm_block |
Tuple of pointer to allocated memory block and it's size. More... | |
Defines | |
#define | __M4RI_ENABLE_MMC |
Enable memory block cache (default: enabled). | |
#define | __M4RI_MMC_NBLOCKS 16 |
Number of blocks that are cached. | |
#define | __M4RI_MMC_THRESHOLD __M4RI_CPU_L2_CACHE |
Maximal size of blocks stored in cache. | |
Typedefs | |
typedef struct _mm_block | mmb_t |
Tuple of pointer to allocated memory block and it's size. | |
Functions | |
void * | m4ri_mmc_malloc (size_t size) |
Allocate size bytes. | |
void | m4ri_mmc_free (void *condemned, size_t size) |
Free the data pointed to by condemned of the given size. | |
void | m4ri_mmc_cleanup (void) |
Cleans up memory block cache. | |
static void * | m4ri_mmc_calloc (size_t count, size_t size) |
Allocate an array of count times size zeroed bytes. |
The mmc memory management functions check a cache for re-usable unused memory before asking the system for it.
static void* m4ri_mmc_calloc | ( | size_t | count, |
size_t | size | ||
) | [inline, static] |
Allocate an array of count times size zeroed bytes.
count | Number of elements. |
size | Number of bytes per element. |
void m4ri_mmc_cleanup | ( | void | ) |
Cleans up memory block cache.
This function is called automatically when the shared library is unloaded.
void m4ri_mmc_free | ( | void * | condemned, |
size_t | size | ||
) |
Free the data pointed to by condemned of the given size.
condemned | Pointer to memory. |
size | Number of bytes. |
void* m4ri_mmc_malloc | ( | size_t | size | ) |
Allocate size bytes.
size | Number of bytes. |