Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

This function is deprecated and will be removed in a future version of this product.

Gets the remaining heap memory pool size available to allocate.

Files

lib_mem.h/lib_mem.c

Prototype

          CPU_SIZE_T  Mem_HeapGetSizeRem (CPU_SIZE_T   align,
                                          LIB_ERR     *perr);

Arguments

align

Desired word boundary alignment (in octets) to return remaining memory size from.

perr

Pointer to variable that will receive the return error code from this function:

LIB_MEM_ERR_NONE
LIB_MEM_ERR_NULL_PTR
LIB_MEM_ERR_INVALID_POOL
LIB_MEM_ERR_INVALID_MEM_ALIGN

Returned Value

Remaining heap memory size (in octets), if no errors;

0, otherwise.

Required Configuration

Available only if LIB_MEM_CFG_HEAP_SIZE is > 0 in lib_cfg.h.

Notes / Warnings

None.

Example Usage

          void        *pmem_blk;
          CPU_SIZE_T   octets_reqd;
          CPU_SIZE_T   size_rem;
          LIB_ERR      err;
           
          pmem_blk = Mem_HeapAlloc((CPU_SIZE_T) 100u,
                                   (CPU_SIZE_T)   4u,
                                   (CPU_SIZE_T)&octets_reqd,
                                   (LIB_ERR  *)&err);
          if (err == LIB_ERR_NONE) {
              size_rem = Mem_HeapGetSizeRem(4u, &err);
              if (err == LIB_ERR_NONE) {
                  printf("%u more octets available.", size_rem);
              }
          }
  • No labels