Built-in Static Block Memory Management

Another alternative memory management capability is static block memory management. This is a faster alternative to the nibble-allocation scheme but one that comes with some limitations. The main limitations are:

Despite these limitations, this type of memory management may be a good choice for simple, memory-based decoding because a decoder normally does not require free and reallocation capabilities. It simply progresses sequentially through a message and allocates memory for decoded items. If decoding in a loop, the rtxMemReset function can be used to free the entries block up for storage for items in the next message.

To use the capability, a user would convert the memory heap created in the context structure during context initialization to use a given block of memory by calling rtxMemHeapConvertStatic as follows:

   /* Convert memory heap to using static block */

   rtxMemHeapConvertStatic 
      (&ctxt.pMemHeap, staticMemHeap, sizeof(staticMemHeap));

The staticMemHeap variable would simply be a byte array of the desired size. It also could be a block of memory allocated using malloc or new.