Snapdragon® Telematics Application Framework (TelAF) Interface Specification
le_mem.h
Go to the documentation of this file.
1 
451 //--------------------------------------------------------------------------------------------------
459 //--------------------------------------------------------------------------------------------------
460 
461 #ifndef LEGATO_MEM_INCLUDE_GUARD
462 #define LEGATO_MEM_INCLUDE_GUARD
463 
464 #include "le_singlyLinkedList.h"
465 
466 #ifndef LE_COMPONENT_NAME
467 # define LE_COMPONENT_NAME
468 #endif
469 
470 //--------------------------------------------------------------------------------------------------
482 //--------------------------------------------------------------------------------------------------
483 typedef void (*le_mem_Destructor_t)
484 (
485  void* objPtr
486 );
487 
488 // Max memory pool name bytes -- must match definition in limit.h
489 #define LE_MEM_LIMIT_MAX_MEM_POOL_NAME_BYTES 32
490 
491 //--------------------------------------------------------------------------------------------------
498 //--------------------------------------------------------------------------------------------------
499 typedef struct le_mem_Pool
500 {
502  struct le_mem_Pool* superPoolPtr;
503 #if LE_CONFIG_MEM_POOL_STATS
505  // These members go before LE_CONFIG_MEM_POOLS so numAllocations will always be aligned, even on
506  // 32-bit architectures, even when LE_CONFIG_MEM_POOLS is not declared
507  size_t numOverflows;
508  uint64_t numAllocations;
509  size_t maxNumBlocksUsed;
511 #endif
512 #if LE_CONFIG_MEM_POOLS
513  le_sls_List_t freeList;
514 #endif
515 
516  size_t userDataSize;
517  size_t blockSize;
518  size_t totalBlocks;
519  size_t numBlocksInUse;
522 #if LE_CONFIG_MEM_TRACE
524  le_log_TraceRef_t memTrace;
525 #endif
527 
529 #if LE_CONFIG_MEM_POOL_NAMES_ENABLED
531 #endif
532 }
534 
535 
536 //--------------------------------------------------------------------------------------------------
541 //--------------------------------------------------------------------------------------------------
542 typedef struct le_mem_Pool* le_mem_PoolRef_t;
543 
544 
545 //--------------------------------------------------------------------------------------------------
549 //--------------------------------------------------------------------------------------------------
550 typedef struct
551 {
552  size_t numBlocksInUse;
554  size_t numOverflows;
555  uint64_t numAllocs;
556  size_t numFree;
557 }
559 
560 
561 #if LE_CONFIG_MEM_TRACE
562  //----------------------------------------------------------------------------------------------
566  //----------------------------------------------------------------------------------------------
567  le_mem_PoolRef_t _le_mem_GetBlockPool
568  (
569  void* objPtr
570  );
571 
572  typedef void* (*_le_mem_AllocFunc_t)(le_mem_PoolRef_t pool);
573 
574  //----------------------------------------------------------------------------------------------
578  //----------------------------------------------------------------------------------------------
579  void* _le_mem_AllocTracer
580  (
581  le_mem_PoolRef_t pool,
582  _le_mem_AllocFunc_t funcPtr,
583  const char* poolFunction,
584  const char* file,
585  const char* callingfunction,
586  size_t line
587  );
589 
590  //----------------------------------------------------------------------------------------------
594  //----------------------------------------------------------------------------------------------
595  void* _le_mem_VarAllocTracer
596  (
597  le_mem_PoolRef_t pool,
598  size_t size,
599  _le_mem_AllocFunc_t funcPtr,
600  const char* poolFunction,
601  const char* file,
602  const char* callingfunction,
603  size_t line
604  );
606 
607  //----------------------------------------------------------------------------------------------
611  //----------------------------------------------------------------------------------------------
612  void _le_mem_Trace
613  (
614  le_mem_PoolRef_t pool,
615  const char* file,
616  const char* callingfunction,
617  size_t line,
618  const char* poolFunction,
620  void* blockPtr
621  );
622 #endif
623 
624 
626 //--------------------------------------------------------------------------------------------------
631 //--------------------------------------------------------------------------------------------------
632 le_mem_PoolRef_t _le_mem_InitStaticPool
633 (
634  const char* componentName,
635  const char* name,
636  size_t numBlocks,
637  size_t objSize,
638  le_mem_Pool_t* poolPtr,
640  void* poolDataPtr
641 );
643 
644 
645 #if LE_CONFIG_MEM_POOL_NAMES_ENABLED
646 //--------------------------------------------------------------------------------------------------
652 //--------------------------------------------------------------------------------------------------
653 le_mem_PoolRef_t _le_mem_CreatePool
654 (
655  const char* componentName,
656  const char* name,
657  size_t objSize
658 );
661 //--------------------------------------------------------------------------------------------------
672 //--------------------------------------------------------------------------------------------------
673 static inline le_mem_PoolRef_t le_mem_CreatePool
674 (
675  const char* name,
676  size_t objSize
677 )
679 {
680  return _le_mem_CreatePool(STRINGIZE(LE_COMPONENT_NAME), name, objSize);
681 }
682 #else /* if not LE_CONFIG_MEM_POOL_NAMES_ENABLED */
683 //--------------------------------------------------------------------------------------------------
689 //--------------------------------------------------------------------------------------------------
690 le_mem_PoolRef_t _le_mem_CreatePool
691 (
692  size_t objSize
693 );
696 //--------------------------------------------------------------------------------------------------
707 //--------------------------------------------------------------------------------------------------
708 LE_DECLARE_INLINE le_mem_PoolRef_t le_mem_CreatePool
709 (
710  const char* name,
711  size_t objSize
712 )
714 {
715  return _le_mem_CreatePool(objSize);
716 }
717 #endif /* end LE_CONFIG_MEM_POOL_NAMES_ENABLED */
718 
719 //--------------------------------------------------------------------------------------------------
725 //--------------------------------------------------------------------------------------------------
726 #define LE_MEM_POOL_WORDS(numBlocks, objSize) \
727  ((numBlocks)*(((sizeof(le_mem_Pool_t*) + sizeof(size_t)) /* sizeof(MemBlock_t) */ + \
728  (((objSize)<sizeof(le_sls_Link_t))?sizeof(le_sls_Link_t):(objSize))+ \
729  sizeof(uint32_t)*LE_CONFIG_NUM_GUARD_BAND_WORDS*2+ \
730  sizeof(size_t) - 1) / sizeof(size_t)))
731 
732 //--------------------------------------------------------------------------------------------------
743 //--------------------------------------------------------------------------------------------------
744 #define LE_MEM_BLOCKS(name, def) (LE_DEFAULT(CAT(_mem_, CAT(name, _POOL_SIZE)), (def)))
745 
746 //--------------------------------------------------------------------------------------------------
759 /*
760  * Internal Note: size_t is used instead of uint8_t to ensure alignment on platforms where
761  * alignment matters.
762  */
763 //--------------------------------------------------------------------------------------------------
764 #if LE_CONFIG_MEM_POOLS
765 # define LE_MEM_DEFINE_STATIC_POOL(name, numBlocks, objSize) \
766  static le_mem_Pool_t _mem_##name##Pool; \
767  static size_t _mem_##name##Data[LE_MEM_POOL_WORDS(LE_MEM_BLOCKS(name, numBlocks), objSize)]
768 #else
769 # define LE_MEM_DEFINE_STATIC_POOL(name, numBlocks, objSize) \
770  static le_mem_Pool_t _mem_##name##Pool
771 #endif
772 
773 //--------------------------------------------------------------------------------------------------
791 /*
792  * Internal Note: size_t is used instead of uint8_t to ensure alignment on platforms where
793  * alignment matters.
794  */
795 //--------------------------------------------------------------------------------------------------
796 #if LE_CONFIG_MEM_POOLS
797 # define LE_MEM_DEFINE_STATIC_POOL_IN_SECTION(name, numBlocks, objSize, sectionName) \
798  static le_mem_Pool_t _mem_##name##Pool __attribute__((section(sectionName))); \
799  static size_t _mem_##name##Data[LE_MEM_POOL_WORDS( \
800  LE_MEM_BLOCKS(name, numBlocks), objSize)] __attribute__((section(sectionName)))
801 #else
802 # define LE_MEM_DEFINE_STATIC_POOL_IN_SECTION(name, numBlocks, objSize, sectionName) \
803  static le_mem_Pool_t _mem_##name##Pool __attribute__((section(sectionName)));
804 #endif
805 
806 //--------------------------------------------------------------------------------------------------
821 //--------------------------------------------------------------------------------------------------
822 #if LE_CONFIG_MEM_POOLS
823 # define le_mem_InitStaticPool(name, numBlocks, objSize) \
824  (inline_static_assert( \
825  sizeof(_mem_##name##Data) == \
826  sizeof(size_t[LE_MEM_POOL_WORDS(LE_MEM_BLOCKS(name, numBlocks), objSize)]), \
827  "initial pool size does not match definition"), \
828  _le_mem_InitStaticPool(STRINGIZE(LE_COMPONENT_NAME), #name, \
829  LE_MEM_BLOCKS(name, numBlocks), (objSize), &_mem_##name##Pool, _mem_##name##Data))
830 #else
831 # define le_mem_InitStaticPool(name, numBlocks, objSize) \
832  _le_mem_InitStaticPool(STRINGIZE(LE_COMPONENT_NAME), #name, \
833  LE_MEM_BLOCKS(name, numBlocks), (objSize), &_mem_##name##Pool, NULL)
834 #endif
835 
836 //--------------------------------------------------------------------------------------------------
845 //--------------------------------------------------------------------------------------------------
846 le_mem_PoolRef_t le_mem_ExpandPool
847 (
848  le_mem_PoolRef_t pool,
849  size_t numObjects
850 );
851 
852 
853 
854 #if !LE_CONFIG_MEM_TRACE
855  //----------------------------------------------------------------------------------------------
863  //----------------------------------------------------------------------------------------------
864  void* le_mem_TryAlloc
865  (
866  le_mem_PoolRef_t pool
867  );
868 #else
869  void* _le_mem_TryAlloc(le_mem_PoolRef_t pool);
872 
873 # define le_mem_TryAlloc(pool) \
874  _le_mem_AllocTracer(pool, \
875  _le_mem_TryAlloc, \
876  "le_mem_TryAlloc", \
877  STRINGIZE(LE_FILENAME), \
878  __FUNCTION__, \
879  __LINE__)
880 
881 #endif
882 
883 
884 #if !LE_CONFIG_MEM_TRACE
885  //----------------------------------------------------------------------------------------------
895  //----------------------------------------------------------------------------------------------
896  void* le_mem_AssertAlloc
897  (
898  le_mem_PoolRef_t pool
899  );
900 #else
901  void* _le_mem_AssertAlloc(le_mem_PoolRef_t pool);
904 
905 # define le_mem_AssertAlloc(pool) \
906  _le_mem_AllocTracer(pool, \
907  _le_mem_AssertAlloc, \
908  "le_mem_AssertAlloc", \
909  STRINGIZE(LE_FILENAME), \
910  __FUNCTION__, \
911  __LINE__)
912 #endif
913 
914 
915 #if !LE_CONFIG_MEM_TRACE
916  //----------------------------------------------------------------------------------------------
926  //----------------------------------------------------------------------------------------------
927  void* le_mem_ForceAlloc
928  (
929  le_mem_PoolRef_t pool
930  );
931 #else
932  void* _le_mem_ForceAlloc(le_mem_PoolRef_t pool);
935 
936 # define le_mem_ForceAlloc(pool) \
937  _le_mem_AllocTracer(pool, \
938  _le_mem_ForceAlloc, \
939  "le_mem_ForceAlloc", \
940  STRINGIZE(LE_FILENAME), \
941  __FUNCTION__, \
942  __LINE__)
943 #endif
944 
945 
946 #if !LE_CONFIG_MEM_TRACE
947  //----------------------------------------------------------------------------------------------
955  //----------------------------------------------------------------------------------------------
956  void* le_mem_TryVarAlloc
957  (
958  le_mem_PoolRef_t pool,
959  size_t size
960  );
961 #else
962  void* _le_mem_TryVarAlloc(le_mem_PoolRef_t pool, size_t size);
965 
966 # define le_mem_TryVarAlloc(pool, size) \
967  _le_mem_VarAllocTracer(pool, \
968  size, \
969  _le_mem_TryVarAlloc, \
970  "le_mem_TryVarAlloc", \
971  STRINGIZE(LE_FILENAME), \
972  __FUNCTION__, \
973  __LINE__)
974 
975 #endif
976 
977 
978 #if !LE_CONFIG_MEM_TRACE
979  //----------------------------------------------------------------------------------------------
989  //----------------------------------------------------------------------------------------------
991  (
992  le_mem_PoolRef_t pool,
993  size_t size
994  );
995 #else
996  void* _le_mem_AssertVarAlloc(le_mem_PoolRef_t pool, size_t size);
999 
1000 # define le_mem_AssertVarAlloc(pool, size) \
1001  _le_mem_VarAllocTracer(pool, \
1002  size, \
1003  _le_mem_AssertVarAlloc, \
1004  "le_mem_AssertVarAlloc", \
1005  STRINGIZE(LE_FILENAME), \
1006  __FUNCTION__, \
1007  __LINE__)
1008 #endif
1009 
1010 
1011 #if !LE_CONFIG_MEM_TRACE
1012  //----------------------------------------------------------------------------------------------
1022  //----------------------------------------------------------------------------------------------
1023  void* le_mem_ForceVarAlloc
1024  (
1025  le_mem_PoolRef_t pool,
1026  size_t size
1027  );
1028 #else
1029  void* _le_mem_ForceVarAlloc(le_mem_PoolRef_t pool, size_t size);
1032 
1033 # define le_mem_ForceVarAlloc(pool, size) \
1034  _le_mem_VarAllocTracer(pool, \
1035  size, \
1036  _le_mem_ForceVarAlloc, \
1037  "le_mem_ForceVarAlloc", \
1038  STRINGIZE(LE_FILENAME), \
1039  __FUNCTION__, \
1040  __LINE__)
1041 #endif
1042 
1043 //--------------------------------------------------------------------------------------------------
1054 //--------------------------------------------------------------------------------------------------
1055 #if LE_CONFIG_MEM_ALLOC_FORCE
1056 # define le_mem_Alloc(pool) le_mem_ForceAlloc(pool)
1057 #elif LE_CONFIG_MEM_ALLOC_ASSERT
1058 # define le_mem_Alloc(pool) le_mem_AssertAlloc(pool)
1059 #else
1060 # error "No supported allocation scheme selected!"
1061 #endif
1062 
1063 //--------------------------------------------------------------------------------------------------
1075 //--------------------------------------------------------------------------------------------------
1076 #if LE_CONFIG_MEM_ALLOC_FORCE
1077 # define le_mem_VarAlloc(pool, size) le_mem_ForceVarAlloc((pool), (size))
1078 #elif LE_CONFIG_MEM_ALLOC_ASSERT
1079 # define le_mem_VarAlloc(pool, size) le_mem_AssertVarAlloc((pool), (size))
1080 #else
1081 # error "No supported allocation scheme selected!"
1082 #endif
1083 
1084 //--------------------------------------------------------------------------------------------------
1094 //--------------------------------------------------------------------------------------------------
1096 (
1097  le_mem_PoolRef_t pool,
1098  size_t numObjects
1099 );
1101 
1102 
1103 #if !LE_CONFIG_MEM_TRACE
1104  //----------------------------------------------------------------------------------------------
1118  //----------------------------------------------------------------------------------------------
1119  void le_mem_Release
1120  (
1121  void* objPtr
1122  );
1123 #else
1124  void _le_mem_Release(void* objPtr);
1127 
1128 # define le_mem_Release(objPtr) \
1129  _le_mem_Trace(_le_mem_GetBlockPool(objPtr), \
1130  STRINGIZE(LE_FILENAME), \
1131  __FUNCTION__, \
1132  __LINE__, \
1133  "le_mem_Release", \
1134  (objPtr)); \
1135  _le_mem_Release(objPtr);
1136 #endif
1137 
1138 
1139 #if !LE_CONFIG_MEM_TRACE
1140  //----------------------------------------------------------------------------------------------
1149  //----------------------------------------------------------------------------------------------
1150  void le_mem_AddRef
1151  (
1152  void* objPtr
1153  );
1154 #else
1155  void _le_mem_AddRef(void* objPtr);
1158 
1159 # define le_mem_AddRef(objPtr) \
1160  _le_mem_Trace(_le_mem_GetBlockPool(objPtr), \
1161  STRINGIZE(LE_FILENAME), \
1162  __FUNCTION__, \
1163  __LINE__, \
1164  "le_mem_AddRef", \
1165  (objPtr)); \
1166  _le_mem_AddRef(objPtr);
1167 #endif
1168 
1169 //--------------------------------------------------------------------------------------------------
1176 //--------------------------------------------------------------------------------------------------
1177 size_t le_mem_GetBlockSize
1178 (
1179  void* objPtr
1180 );
1181 
1182 //----------------------------------------------------------------------------------------------
1195 //----------------------------------------------------------------------------------------------
1196 size_t le_mem_GetRefCount
1197 (
1198  void* objPtr
1199 );
1200 
1201 
1202 //--------------------------------------------------------------------------------------------------
1211 //--------------------------------------------------------------------------------------------------
1213 (
1214  le_mem_PoolRef_t pool,
1215  le_mem_Destructor_t destructor
1216 );
1217 
1218 
1219 //--------------------------------------------------------------------------------------------------
1226 //--------------------------------------------------------------------------------------------------
1227 void le_mem_GetStats
1228 (
1229  le_mem_PoolRef_t pool,
1230  le_mem_PoolStats_t* statsPtr
1231 );
1232 
1233 
1234 //--------------------------------------------------------------------------------------------------
1241 //--------------------------------------------------------------------------------------------------
1242 void le_mem_ResetStats
1243 (
1244  le_mem_PoolRef_t pool
1245 );
1246 
1247 
1248 //--------------------------------------------------------------------------------------------------
1259 //--------------------------------------------------------------------------------------------------
1261 (
1262  le_mem_PoolRef_t pool,
1263  char* namePtr,
1264  size_t bufSize
1265 );
1266 
1267 
1268 //--------------------------------------------------------------------------------------------------
1276 //--------------------------------------------------------------------------------------------------
1277 bool le_mem_IsSubPool
1278 (
1279  le_mem_PoolRef_t pool
1280 );
1281 
1282 
1283 //--------------------------------------------------------------------------------------------------
1291 //--------------------------------------------------------------------------------------------------
1292 size_t le_mem_GetObjectCount
1293 (
1294  le_mem_PoolRef_t pool
1295 );
1296 
1297 
1298 //--------------------------------------------------------------------------------------------------
1305 //--------------------------------------------------------------------------------------------------
1306 size_t le_mem_GetObjectSize
1307 (
1308  le_mem_PoolRef_t pool
1309 );
1310 
1311 
1312 //--------------------------------------------------------------------------------------------------
1319 //--------------------------------------------------------------------------------------------------
1321 (
1322  le_mem_PoolRef_t pool
1323 );
1324 
1325 
1326 #if LE_CONFIG_MEM_POOL_NAMES_ENABLED
1327 //--------------------------------------------------------------------------------------------------
1333 //--------------------------------------------------------------------------------------------------
1334 le_mem_PoolRef_t _le_mem_FindPool
1335 (
1336  const char* componentName,
1337  const char* name
1338 );
1340 //--------------------------------------------------------------------------------------------------
1347 //--------------------------------------------------------------------------------------------------
1348 static inline le_mem_PoolRef_t le_mem_FindPool
1350  const char* name
1351 )
1352 {
1353  return _le_mem_FindPool(STRINGIZE(LE_COMPONENT_NAME), name);
1354 }
1355 #else
1356 //--------------------------------------------------------------------------------------------------
1363 //--------------------------------------------------------------------------------------------------
1364 LE_DECLARE_INLINE le_mem_PoolRef_t le_mem_FindPool
1365 (
1366  const char* name
1367 )
1368 {
1369  return NULL;
1370 }
1371 #endif /* end LE_CONFIG_MEM_POOL_NAMES_ENABLED */
1372 
1373 
1374 #if LE_CONFIG_MEM_POOL_NAMES_ENABLED
1375 //--------------------------------------------------------------------------------------------------
1381 //--------------------------------------------------------------------------------------------------
1382 le_mem_PoolRef_t _le_mem_CreateSubPool
1383 (
1384  le_mem_PoolRef_t superPool,
1385  const char* componentName,
1386  const char* name,
1387  size_t numObjects
1389 );
1391 //--------------------------------------------------------------------------------------------------
1400 //--------------------------------------------------------------------------------------------------
1401 static inline le_mem_PoolRef_t le_mem_CreateSubPool
1403  le_mem_PoolRef_t superPool,
1404  const char* name,
1405  size_t numObjects
1407 )
1408 {
1409  return _le_mem_CreateSubPool(superPool, STRINGIZE(LE_COMPONENT_NAME), name, numObjects);
1410 }
1411 #else /* if not LE_CONFIG_MEM_POOL_NAMES_ENABLED */
1412 //--------------------------------------------------------------------------------------------------
1418 //--------------------------------------------------------------------------------------------------
1419 le_mem_PoolRef_t _le_mem_CreateSubPool
1420 (
1421  le_mem_PoolRef_t superPool,
1422  size_t numObjects
1423 );
1425 //--------------------------------------------------------------------------------------------------
1434 //--------------------------------------------------------------------------------------------------
1435 LE_DECLARE_INLINE le_mem_PoolRef_t le_mem_CreateSubPool
1436 (
1437  le_mem_PoolRef_t superPool,
1438  const char* name,
1439  size_t numObjects
1441 )
1442 {
1443  return _le_mem_CreateSubPool(superPool, numObjects);
1444 }
1445 #endif /* end LE_CONFIG_MEM_POOL_NAMES_ENABLED */
1446 
1447 
1448 #if LE_CONFIG_MEM_POOL_NAMES_ENABLED
1449 //--------------------------------------------------------------------------------------------------
1455 //--------------------------------------------------------------------------------------------------
1456 le_mem_PoolRef_t _le_mem_CreateReducedPool
1457 (
1458  le_mem_PoolRef_t superPool,
1459  const char* componentName,
1460  const char* name,
1461  size_t numObjects,
1463  size_t objSize
1464 );
1466 //--------------------------------------------------------------------------------------------------
1475 //--------------------------------------------------------------------------------------------------
1476 static inline le_mem_PoolRef_t le_mem_CreateReducedPool
1478  le_mem_PoolRef_t superPool,
1479  const char* name,
1480  size_t numObjects,
1482  size_t objSize
1484 )
1485 {
1486  return _le_mem_CreateReducedPool(superPool, STRINGIZE(LE_COMPONENT_NAME), name, numObjects, objSize);
1487 }
1488 #else /* if not LE_CONFIG_MEM_POOL_NAMES_ENABLED */
1489 //--------------------------------------------------------------------------------------------------
1495 //--------------------------------------------------------------------------------------------------
1496 le_mem_PoolRef_t _le_mem_CreateReducedPool
1497 (
1498  le_mem_PoolRef_t superPool,
1499  size_t numObjects,
1500  size_t objSize
1502 );
1504 //--------------------------------------------------------------------------------------------------
1513 //--------------------------------------------------------------------------------------------------
1515 (
1516  le_mem_PoolRef_t superPool,
1517  const char* name,
1518  size_t numObjects,
1520  size_t objSize
1522 )
1523 {
1524  return _le_mem_CreateReducedPool(superPool, numObjects, objSize);
1525 }
1526 #endif /* end LE_CONFIG_MEM_POOL_NAMES_ENABLED */
1527 
1528 
1529 //--------------------------------------------------------------------------------------------------
1538 //--------------------------------------------------------------------------------------------------
1540 (
1541  le_mem_PoolRef_t subPool
1542 );
1543 
1544 #if LE_CONFIG_RTOS
1545 //--------------------------------------------------------------------------------------------------
1554 //--------------------------------------------------------------------------------------------------
1555 void le_mem_Hibernate
1556 (
1557  void **freeStartPtr,
1558  void **freeEndPtr
1560 );
1561 
1562 //--------------------------------------------------------------------------------------------------
1571 //--------------------------------------------------------------------------------------------------
1572 void le_mem_Resume
1573 (
1574  void
1575 );
1576 
1577 #endif /* end LE_CONFIG_RTOS */
1578 
1579 //--------------------------------------------------------------------------------------------------
1587 //--------------------------------------------------------------------------------------------------
1588 char *le_mem_StrDup
1589 (
1590  le_mem_PoolRef_t poolRef,
1591  const char *srcStr
1592 );
1593 
1594 #endif // LEGATO_MEM_INCLUDE_GUARD
void * le_mem_AssertVarAlloc(le_mem_PoolRef_t pool, size_t size)
size_t le_mem_GetObjectSize(le_mem_PoolRef_t pool)
static le_mem_PoolRef_t le_mem_CreateReducedPool(le_mem_PoolRef_t superPool, const char *name, size_t numObjects, size_t objSize)
Definition: le_mem.h:1477
size_t blockSize
Number of bytes in a block, including all overhead.
Definition: le_mem.h:517
uint64_t numAllocs
Number of times an object has been allocated from this pool.
Definition: le_mem.h:555
char * le_mem_StrDup(le_mem_PoolRef_t poolRef, const char *srcStr)
LE_DECLARE_INLINE le_mem_PoolRef_t le_mem_CreatePool(const char *name, size_t objSize)
Definition: le_mem.h:709
Definition: le_singlyLinkedList.h:201
size_t numBlocksInUse
Number of currently allocated blocks.
Definition: le_mem.h:552
size_t numOverflows
Number of times le_mem_ForceAlloc() had to expand the pool.
Definition: le_mem.h:554
Definition: le_doublyLinkedList.h:200
size_t le_mem_GetBlockSize(void *objPtr)
void(* le_mem_Destructor_t)(void *objPtr)
Definition: le_mem.h:484
#define STRINGIZE(x)
Definition: le_basics.h:231
le_dls_Link_t poolLink
This pool&#39;s link in the list of memory pools.
Definition: le_mem.h:501
size_t maxNumBlocksUsed
Maximum number of allocated blocks at any one time.
Definition: le_mem.h:553
struct le_mem_Pool * superPoolPtr
Definition: le_mem.h:502
Definition: le_mem.h:499
void * le_mem_TryAlloc(le_mem_PoolRef_t pool)
void * le_mem_TryVarAlloc(le_mem_PoolRef_t pool, size_t size)
size_t numFree
Number of free objects currently available in this pool.
Definition: le_mem.h:556
void le_mem_GetStats(le_mem_PoolRef_t pool, le_mem_PoolStats_t *statsPtr)
void * le_mem_AssertAlloc(le_mem_PoolRef_t pool)
void le_mem_Hibernate(void **freeStartPtr, void **freeEndPtr)
size_t le_mem_GetRefCount(void *objPtr)
size_t le_mem_GetObjectFullSize(le_mem_PoolRef_t pool)
void * le_mem_ForceVarAlloc(le_mem_PoolRef_t pool, size_t size)
Definition: le_mem.h:550
#define LE_DECLARE_INLINE
Definition: le_basics.h:330
void le_mem_Release(void *objPtr)
void le_mem_Resume(void)
bool le_mem_IsSubPool(le_mem_PoolRef_t pool)
void * le_mem_ForceAlloc(le_mem_PoolRef_t pool)
static le_mem_PoolRef_t le_mem_FindPool(const char *name)
Definition: le_mem.h:1349
size_t le_mem_GetObjectCount(le_mem_PoolRef_t pool)
void le_mem_SetDestructor(le_mem_PoolRef_t pool, le_mem_Destructor_t destructor)
struct le_mem_Pool * le_mem_PoolRef_t
Definition: le_mem.h:542
void le_mem_SetNumObjsToForce(le_mem_PoolRef_t pool, size_t numObjects)
le_result_t le_mem_GetName(le_mem_PoolRef_t pool, char *namePtr, size_t bufSize)
size_t numBlocksToForce
Definition: le_mem.h:521
void le_mem_DeleteSubPool(le_mem_PoolRef_t subPool)
void le_mem_AddRef(void *objPtr)
static le_mem_PoolRef_t le_mem_CreateSubPool(le_mem_PoolRef_t superPool, const char *name, size_t numObjects)
Definition: le_mem.h:1402
le_result_t
Definition: le_basics.h:45
#define LE_MEM_LIMIT_MAX_MEM_POOL_NAME_BYTES
Definition: le_mem.h:489
#define LE_COMPONENT_NAME
Definition: le_mem.h:467
le_mem_PoolRef_t le_mem_ExpandPool(le_mem_PoolRef_t pool, size_t numObjects)
size_t userDataSize
Size of the object requested by the client in bytes.
Definition: le_mem.h:516
void le_mem_ResetStats(le_mem_PoolRef_t pool)
size_t totalBlocks
Definition: le_mem.h:518
le_mem_Destructor_t destructor
The destructor for objects in this pool.
Definition: le_mem.h:528