All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
le_mem.h
Go to the documentation of this file.
1 
384 //--------------------------------------------------------------------------------------------------
393 #ifndef LEGATO_MEM_INCLUDE_GUARD
394 #define LEGATO_MEM_INCLUDE_GUARD
395 
396 //--------------------------------------------------------------------------------------------------
401 //--------------------------------------------------------------------------------------------------
402 typedef struct le_mem_Pool* le_mem_PoolRef_t;
403 
404 
405 //--------------------------------------------------------------------------------------------------
417 //--------------------------------------------------------------------------------------------------
418 typedef void (*le_mem_Destructor_t)
419 (
420  void* objPtr
421 );
422 
423 
424 //--------------------------------------------------------------------------------------------------
428 //--------------------------------------------------------------------------------------------------
429 typedef struct
430 {
431  size_t numBlocksInUse;
433  size_t numOverflows;
434  uint64_t numAllocs;
435  size_t numFree;
436 }
438 
439 
440 //--------------------------------------------------------------------------------------------------
451 //--------------------------------------------------------------------------------------------------
453 (
454  const char* name,
455  size_t objSize
456 );
458 
459 
460 //--------------------------------------------------------------------------------------------------
469 //--------------------------------------------------------------------------------------------------
471 (
472  le_mem_PoolRef_t pool,
473  size_t numObjects
474 );
475 
476 
477 //--------------------------------------------------------------------------------------------------
485 //--------------------------------------------------------------------------------------------------
486 void* le_mem_TryAlloc
487 (
488  le_mem_PoolRef_t pool
489 );
490 
491 
492 //--------------------------------------------------------------------------------------------------
502 //--------------------------------------------------------------------------------------------------
503 void* le_mem_AssertAlloc
504 (
505  le_mem_PoolRef_t pool
506 );
507 
508 
509 //--------------------------------------------------------------------------------------------------
519 //--------------------------------------------------------------------------------------------------
520 void* le_mem_ForceAlloc
521 (
522  le_mem_PoolRef_t pool
523 );
524 
525 
526 //--------------------------------------------------------------------------------------------------
536 //--------------------------------------------------------------------------------------------------
538 (
539  le_mem_PoolRef_t pool,
540  size_t numObjects
541 );
543 
544 
545 //--------------------------------------------------------------------------------------------------
559 //--------------------------------------------------------------------------------------------------
560 void le_mem_Release
561 (
562  void* objPtr
563 );
564 
565 
566 //--------------------------------------------------------------------------------------------------
575 //--------------------------------------------------------------------------------------------------
576 void le_mem_AddRef
577 (
578  void* objPtr
579 );
580 
581 
582 //--------------------------------------------------------------------------------------------------
591 //--------------------------------------------------------------------------------------------------
593 (
594  le_mem_PoolRef_t pool,
595  le_mem_Destructor_t destructor
596 );
597 
598 
599 //--------------------------------------------------------------------------------------------------
606 //--------------------------------------------------------------------------------------------------
607 void le_mem_GetStats
608 (
609  le_mem_PoolRef_t pool,
610  le_mem_PoolStats_t* statsPtr
611 );
612 
613 
614 //--------------------------------------------------------------------------------------------------
621 //--------------------------------------------------------------------------------------------------
623 (
624  le_mem_PoolRef_t pool
625 );
626 
627 
628 //--------------------------------------------------------------------------------------------------
636 //--------------------------------------------------------------------------------------------------
638 (
639  le_mem_PoolRef_t pool,
640  char* namePtr,
641  size_t bufSize
642 );
643 
644 
645 //--------------------------------------------------------------------------------------------------
653 //--------------------------------------------------------------------------------------------------
654 const bool le_mem_IsSubPool
655 (
656  le_mem_PoolRef_t pool
657 );
658 
659 
660 //--------------------------------------------------------------------------------------------------
668 //--------------------------------------------------------------------------------------------------
670 (
671  le_mem_PoolRef_t pool
672 );
673 
674 
675 //--------------------------------------------------------------------------------------------------
682 //--------------------------------------------------------------------------------------------------
684 (
685  le_mem_PoolRef_t pool
686 );
687 
688 
689 //--------------------------------------------------------------------------------------------------
696 //--------------------------------------------------------------------------------------------------
698 (
699  le_mem_PoolRef_t pool
700 );
701 
702 
703 //--------------------------------------------------------------------------------------------------
710 //--------------------------------------------------------------------------------------------------
712 (
713  const char* name
714 );
715 
716 
717 //--------------------------------------------------------------------------------------------------
727 //--------------------------------------------------------------------------------------------------
729 (
730  le_mem_PoolRef_t superPool,
731  const char* name,
732  size_t numObjects
734 );
735 
736 
737 //--------------------------------------------------------------------------------------------------
746 //--------------------------------------------------------------------------------------------------
748 (
749  le_mem_PoolRef_t subPool
750 );
751 
752 
753 #endif // LEGATO_MEM_INCLUDE_GUARD
void * le_mem_TryAlloc(le_mem_PoolRef_t pool)
size_t le_mem_GetTotalNumObjs(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:434
le_result_t
Definition: le_basics.h:34
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:431
size_t maxNumBlocksUsed
Maximum number of allocated blocks at any one time.
Definition: le_mem.h:432
void le_mem_SetDestructor(le_mem_PoolRef_t pool, le_mem_Destructor_t destructor)
void le_mem_ResetStats(le_mem_PoolRef_t pool)
void(* le_mem_Destructor_t)(void *objPtr)
Definition: le_mem.h:419
void le_mem_SetNumObjsToForce(le_mem_PoolRef_t pool, size_t numObjects)
void le_mem_DeleteSubPool(le_mem_PoolRef_t subPool)
le_mem_PoolRef_t le_mem_FindPool(const char *name)
struct le_mem_Pool * le_mem_PoolRef_t
Definition: le_mem.h:402
le_mem_PoolRef_t le_mem_CreatePool(const char *name, size_t objSize)
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:435
size_t numOverflows
Number of times le_mem_ForceAlloc() had to expand the pool.
Definition: le_mem.h:433
Definition: le_mem.h:429
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)
le_mem_PoolRef_t le_mem_CreateSubPool(le_mem_PoolRef_t superPool, const char *name, size_t numObjects)