XBinder  Version 2.9.x
Functions
rtxMemStatic.h File Reference

Simplistic low-level memory manager which allocates memory from out of given block of memory. More...

#include "osSysTypes.h"

Go to the source code of this file.

Functions

void rtxMemSetStaticAlloc (OSOCTET *staticHeap, OSSIZE staticHeapSize)
 Install a simplistic low-level memory manager, by calling rtxMemSetAllocFuncs (which see). More...
 
void rtxMemFreeStatic ()
 Frees all memory made by the static allocator (which is set by rtxMemSetStaticAlloc). More...
 

Detailed Description

Simplistic low-level memory manager which allocates memory from out of given block of memory.

Definition in file rtxMemStatic.h.

Function Documentation

◆ rtxMemFreeStatic()

void rtxMemFreeStatic ( )

Frees all memory made by the static allocator (which is set by rtxMemSetStaticAlloc).

This makes all of the memory, given to rtxMemSetStaticAlloc, available for allocation again. Before calling this function, all contexts must have been freed by calling rtFreeContext for each context.

◆ rtxMemSetStaticAlloc()

void rtxMemSetStaticAlloc ( OSOCTET *  staticHeap,
OSSIZE  staticHeapSize 
)

Install a simplistic low-level memory manager, by calling rtxMemSetAllocFuncs (which see).

The low-level manager is responsible for allocating memory to the high-level manager and to code which does not have access to a high-level manager (e.g. during context initialization).

The installed manager has these properties:

  • Allocations are made out of the given block of memory.
  • Does not support memory reallocation.
  • Does not support freeing individually allocated blocks.
  • Is not thread-safe; not suitable for multi-threaded use of Objective Systems code.

This manager is intended for use in applications where the system memory allocator cannot be used to dynamically allocate memory, to allow for some limited dynamic memory allocations required by the Objective Systems' runtime.

The built-in (high-level) memory manager uses the low-level manager to obtain more memory when needed. The high-level manager may itself be configured to satisfy memory requests to it by carving up a given block of memory; this is done by calling rtxMemStaticHeapCreate or rtxMemHeapConvertStatic. When the high-level manager is set to use a static heap, fewer requests will be made of the low-level manager.

This function must be called before any memory allocations are made, which means it must be called before any calls are made to initialize a context.

This function may be called to provide a new staticHeap any time that rtxMemFreeStatic could be called.