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 RT_MH_DONTKEEPFREE   0x1
#define RT_MH_VALIDATEPTR   0x2
#define RT_MH_CHECKHEAP   0x4
#define RT_MH_TRACE   0x8
#define RT_MH_DIAG   0x10
#define RT_MH_DIAG_DEBUG   0x20
#define RT_MH_ZEROONFREE   0x40
#define OSRTMH_PROPID_DEFBLKSIZE   1
#define OSRTMH_PROPID_SETFLAGS   2
#define OSRTMH_PROPID_CLEARFLAGS   3
#define OSRTMH_PROPID_KEEPFREEUNITS   4
#define OSRTMH_PROPID_USER   10
#define OSRTXM_K_MEMBLKSIZ   (4*1024)
#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 OSCRTMALLOC0(nbytes)   malloc(nbytes)
#define OSCRTFREE0(ptr)   free(ptr)
#define OSCRTMALLOC   rtxMemAlloc
#define OSCRTFREE   rtxMemFreePtr
#define OSCDECL
#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 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 rtxMemFree(pctxt)   rtxMemHeapFreeAll(&(pctxt)->pMemHeap)
 Free memory associated with a context.
#define rtxMemReset(pctxt)   rtxMemHeapReset(&(pctxt)->pMemHeap)
 Reset memory associated with a context.
#define rtxMemAllocType(pctxt, ctype)   (ctype*)rtxMemHeapAlloc(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type.
#define rtxMemAllocTypeZ(pctxt, ctype)   (ctype*)rtxMemHeapAllocZ(&(pctxt)->pMemHeap,sizeof(ctype))
 Allocate type and zero memory.
#define rtxMemFreeType(pctxt, mem_p)   rtxMemHeapFreePtr(&(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 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 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 ()
 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.

Detailed Description

Memory management function and macro definitions.

Definition in file rtxMemory.h.