XBinder  Version 2.6.x
Macros | Functions
rtxMemory.h File Reference

Memory management function and macro definitions. More...

#include "rtxsrc/rtxContext.h"

Go to the source code of this file.

Macros

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

Functions

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

Detailed Description

Memory management function and macro definitions.

Definition in file rtxMemory.h.