The XBinder run-time uses several different memory management schemes in order to provide flexibility in handling different types of application's memory requirements. The following are the schemes available in this release:
Standard
Nibble-Allocation
Custom
The standard memory allocation algorithm simply maps XBinder run-time function calls directly to the C standard run-time memory functions malloc, free, and realloc . (Note: in some environments such as some embedded RTOS's the realloc function may not be available. The built-in run-time provides a custom implementation of this function using malloc and free for these cases). The advantages of standard management are simplicity and space-optimization. The primary disadvantage is performance - frequent calls to malloc and free can be detrimental to performance.
The nibble-allocation algorithm is designed to improve performance in the case where frequent requests for small amounts of memory are made. This is typical of many data-binding applications due to unconstrained types being declared within the schema. The way this algorithm works is 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.
Finally, it is possible for a user to build in his or her own custom management by implementing the functions defined within the standard XBinder run-time memory management interface.
The main entry points to the memory management system for users are the rtxMemAlloc, rtxMemFree, rtxMemFreePtr, and rtxMemRealloc functions. These are the functions that should always be used for doing memory management - not the built-in C memory functions.
For more information on memory management, see the section "Memory Management Functions" in the chapter "C Common Runtime Library" of this manual.