Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Gets a single memory block from the heap.

Warning

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

...

.

Files

lib_mem.h/lib_mem.c

Prototype

Code Block
languagecpp
void  *Mem_HeapAlloc (CPU_SIZE_T   size,
                      CPU_SIZE_T   align,
                      CPU_SIZE_T  *poctets_reqd,
                      LIB_ERR     *perr);


Arguments

size

Size of requested memory block (in octets).

...

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

Notes / Warnings

...

None.

Example Usage

CaptionText
Code Block
LanguageC++
CAPTIONlanguagecpp
          void        *pmem_blk;
          CPU_SIZE_T   octets_reqd;
          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) {
              printf("COULD NOT GET MEMORY BLOCK FROM HEAP.");
          }