The ASN1C Default Memory Manager

The default ASN1C run-time memory manager uses an algorithm called the nibble-allocation algorithm. Large blocks of memory are allocated up front and then split up to provide memory for smaller allocation requests. This reduces the number of calls required to the C malloc and free functions, which are very expensive in terms of performance.

The large blocks of memory are tracked through the ASN.1 context (OSCTXT) structure. For C, this means that an initialized context block is required for all memory allocations and deallocations. All allocations are done using this block as an argument to routines such as rtxMemAlloc. All memory can be released at once when a user is done with a structure containing dynamic memory items by calling rtxMemFree. Other functions are available for doing other dynamic memory operations as well. See the C/C++ Run-time Reference Manual for details on these.