rtxMemory.h File Reference

Memory management function and macro definitions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Defines

#define OSRTALLOCTYPE(pctxt, type)   (type*) rtxMemHeapAlloc (&(pctxt)->pMemHeap, sizeof(type))
 This macro allocates a single element of the given type.
#define OSRTALLOCTYPEZ(pctxt, type)   (type*) rtxMemHeapAllocZ (&(pctxt)->pMemHeap, sizeof(type))
 This macro allocates and zeros a single element of the given type.
#define OSRTREALLOCARRAY(pctxt, pseqof, type)
 Reallocate an array.
#define rtxMemAlloc(pctxt, nbytes)   rtxMemHeapAlloc(&(pctxt)->pMemHeap,nbytes)
 Allocate memory.
#define rtxMemSysAlloc(pctxt, nbytes)   rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,nbytes)
 This macro makes a direct call to the configured system memory allocation function.
#define rtxMemAllocZ(pctxt, nbytes)   rtxMemHeapAllocZ(&(pctxt)->pMemHeap,nbytes)
 Allocate and zero memory.
#define rtxMemSysAllocZ(pctxt, nbytes)   rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,nbytes)
 Allocate and zero memory.
#define rtxMemRealloc(pctxt, mem_p, nbytes)   rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, nbytes)
 Reallocate memory.
#define rtxMemSysRealloc(pctxt, mem_p, nbytes)   rtxMemHeapSysRealloc(&(pctxt)->pMemHeap,(void*)mem_p,nbytes)
 This macro makes a direct call to the configured system memory reallocation function to do the reallocation.
#define rtxMemFreePtr(pctxt, mem_p)   rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Free memory pointer.
#define rtxMemSysFreePtr(pctxt, mem_p)   rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 This macro makes a direct call to the configured system memory free function.
#define rtxMemAllocType(pctxt, ctype)   (ctype*)rtxMemHeapAlloc(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type.
#define rtxMemSysAllocType(pctxt, ctype)   (ctype*)rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type.
#define rtxMemAllocTypeZ(pctxt, ctype)   (ctype*)rtxMemHeapAllocZ(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type and zero memory.
#define rtxMemSysAllocTypeZ(pctxt, ctype)   (ctype*)rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type and zero memory.
#define rtxMemFreeType(pctxt, mem_p)   rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Free memory pointer.
#define rtxMemSysFreeType(pctxt, mem_p)   rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Free memory pointer.
#define rtxMemAllocArray(pctxt, n, type)   (type*)rtxMemHeapAlloc (&(pctxt)->pMemHeap, sizeof(type)*n)
 Allocate a dynamic array.
#define rtxMemSysAllocArray(pctxt, n, type)   (type*)rtxMemHeapSysAlloc (&(pctxt)->pMemHeap, sizeof(type)*n)
 Allocate a dynamic array.
#define rtxMemAllocArrayZ(pctxt, n, type)   (type*)rtxMemHeapAllocZ (&(pctxt)->pMemHeap, sizeof(type)*n)
 Allocate a dynamic array and zero memory.
#define rtxMemFreeArray(pctxt, mem_p)   rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Free memory pointer.
#define rtxMemSysFreeArray(pctxt, mem_p)   rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Free memory pointer.
#define rtxMemReallocArray(pctxt, mem_p, n, type)   (type*)rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, sizeof(type)*n)
 Reallocate memory.
#define rtxMemNewAutoPtr(pctxt, nbytes)   rtxMemHeapAlloc(&(pctxt)->pMemHeap, nbytes)
 This function allocates a new block of memory and creates an auto-pointer with reference count set to one.
#define rtxMemAutoPtrRef(pctxt, ptr)   rtxMemHeapAutoPtrRef(&(pctxt)->pMemHeap, (void*)(ptr))
 This function increments the auto-pointer reference count.
#define rtxMemAutoPtrUnref(pctxt, ptr)   rtxMemHeapAutoPtrUnref(&(pctxt)->pMemHeap, (void*)(ptr))
 This function decrements the auto-pointer reference count.
#define rtxMemAutoPtrGetRefCount(pctxt, ptr)   rtxMemHeapAutoPtrGetRefCount(&(pctxt)->pMemHeap, (void*)(ptr))
 This function returns the reference count of the given pointer.
#define rtxMemCheckPtr(pctxt, mem_p)   rtxMemHeapCheckPtr(&(pctxt)->pMemHeap, (void*)mem_p)
 Check memory pointer.
#define rtxMemCheck(pctxt)   rtxMemHeapCheck(&(pctxt)->pMemHeap, __FILE__, __LINE__)
 Check memory heap.
#define rtxMemPrint(pctxt)   rtxMemHeapPrint(&(pctxt)->pMemHeap)
 Print memory heap structure to stderr.
#define rtxMemSetProperty(pctxt, propId, pProp)   rtxMemHeapSetProperty (&(pctxt)->pMemHeap, propId, pProp)
 Set memory heap property.

Functions

EXTERNRT void rtxMemSetAllocFuncs (OSMallocFunc malloc_func, OSReallocFunc realloc_func, OSFreeFunc free_func)
 This function sets the pointers to standard allocation functions.
EXTERNRT OSUINT32 rtxMemHeapGetDefBlkSize (OSCTXT *pctxt)
 This function returns the actual granularity of memory blocks in the context.
EXTERNRT void rtxMemSetDefBlkSize (OSUINT32 blkSize)
 This function sets the minimum size and the granularity of memory blocks for newly created memory heaps.
EXTERNRT OSUINT32 rtxMemGetDefBlkSize (OSVOIDARG)
 This function returns the actual granularity of memory blocks.
EXTERNRT OSBOOL rtxMemHeapIsEmpty (OSCTXT *pctxt)
 This function determines if the memory heap defined in the give context is empty (i.e.
EXTERNRT OSBOOL rtxMemIsZero (const void *pmem, size_t memsiz)
 This helper function determines if an arbitrarily sized block of memory is set to zero.
EXTERNRT void rtxMemFree (OSCTXT *pctxt)
 Free memory associated with a context.
EXTERNRT void rtxMemReset (OSCTXT *pctxt)
 Reset memory associated with a context.

Detailed Description

Memory management function and macro definitions.

Definition in file rtxMemory.h.