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 release the memory heap created in the context structure after initialization with the static block they wanted to use using the rtxMemStaticHeapCreate function as follows:

   /* Set static memory heap */

   rtxMemHeapRelease (&ctxt.pMemHeap);
   rtxMemStaticHeapCreate 
      (&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.