400 #ifndef LEGATO_MEM_INCLUDE_GUARD
401 #define LEGATO_MEM_INCLUDE_GUARD
403 #ifndef LEGATO_COMPONENT
404 #define LEGATO_COMPONENT
470 void* _le_mem_AllocTracer
473 _le_mem_AllocFunc_t funcPtr,
474 const char* poolFunction,
476 const char* callingfunction,
490 const char* callingfunction,
492 const char* poolFunction,
508 const char* componentName,
535 return _le_mem_CreatePool(
STRINGIZE(LEGATO_COMPONENT), name, objSize);
576 #define le_mem_TryAlloc(pool) \
577 _le_mem_AllocTracer(pool, \
608 #define le_mem_AssertAlloc(pool) \
609 _le_mem_AllocTracer(pool, \
610 _le_mem_AssertAlloc, \
611 "le_mem_AssertAlloc", \
639 #define le_mem_ForceAlloc(pool) \
640 _le_mem_AllocTracer(pool, \
641 _le_mem_ForceAlloc, \
642 "le_mem_ForceAlloc", \
689 void _le_mem_Release(
void* objPtr);
693 #define le_mem_Release(objPtr) \
694 _le_mem_Trace(_le_mem_GetBlockPool(objPtr), \
700 _le_mem_Release(objPtr);
720 void _le_mem_AddRef(
void* objPtr);
724 #define le_mem_AddRef(objPtr) \
725 _le_mem_Trace(_le_mem_GetBlockPool(objPtr), \
731 _le_mem_AddRef(objPtr);
868 const char* componentName,
887 return _le_mem_FindPool(
STRINGIZE(LEGATO_COMPONENT), name);
901 const char* componentName,
928 return _le_mem_CreateSubPool(superPool,
STRINGIZE(LEGATO_COMPONENT), name, numObjects);
948 #endif // LEGATO_MEM_INCLUDE_GUARD
void * le_mem_TryAlloc(le_mem_PoolRef_t pool)
le_mem_PoolRef_t le_mem_ExpandPool(le_mem_PoolRef_t pool, size_t numObjects)
uint64_t numAllocs
Number of times an object has been allocated from this pool.
Definition: le_mem.h:446
le_result_t
Definition: le_basics.h:35
void * le_mem_AssertAlloc(le_mem_PoolRef_t pool)
void le_mem_GetStats(le_mem_PoolRef_t pool, le_mem_PoolStats_t *statsPtr)
const bool le_mem_IsSubPool(le_mem_PoolRef_t pool)
size_t numBlocksInUse
Number of currently allocated blocks.
Definition: le_mem.h:443
static le_mem_PoolRef_t le_mem_FindPool(const char *name)
Definition: le_mem.h:883
size_t maxNumBlocksUsed
Maximum number of allocated blocks at any one time.
Definition: le_mem.h:444
#define STRINGIZE(x)
Definition: le_basics.h:205
void le_mem_SetDestructor(le_mem_PoolRef_t pool, le_mem_Destructor_t destructor)
static le_mem_PoolRef_t le_mem_CreatePool(const char *name, size_t objSize)
Definition: le_mem.h:529
void le_mem_ResetStats(le_mem_PoolRef_t pool)
void le_mem_SetNumObjsToForce(le_mem_PoolRef_t pool, size_t numObjects)
void le_mem_DeleteSubPool(le_mem_PoolRef_t subPool)
struct le_mem_Pool * le_mem_PoolRef_t
Definition: le_mem.h:414
le_result_t le_mem_GetName(le_mem_PoolRef_t pool, char *namePtr, size_t bufSize)
void le_mem_Release(void *objPtr)
size_t numFree
Number of free objects currently available in this pool.
Definition: le_mem.h:447
size_t numOverflows
Number of times le_mem_ForceAlloc() had to expand the pool.
Definition: le_mem.h:445
void(* le_mem_Destructor_t)(void *objPtr)
Definition: le_mem.h:431
size_t le_mem_GetObjectCount(le_mem_PoolRef_t pool)
size_t le_mem_GetObjectFullSize(le_mem_PoolRef_t pool)
size_t le_mem_GetObjectSize(le_mem_PoolRef_t pool)
void le_mem_AddRef(void *objPtr)
void * le_mem_ForceAlloc(le_mem_PoolRef_t pool)
static le_mem_PoolRef_t le_mem_CreateSubPool(le_mem_PoolRef_t superPool, const char *name, size_t numObjects)
Definition: le_mem.h:921