ASN1C C/C++ Common Runtime
ASN1C v7.8.x
|
Macros | |
#define | ALLOC_ASN1ARRAY(pctxt, pseqof, type) |
#define | ALLOC_ASN1ARRAY1(pctxt, pseqof, type) |
#define | OSRTALLOCTYPE(pctxt, type) (type*) rtxMemHeapAlloc (&(pctxt)->pMemHeap, sizeof(type)) |
#define | OSRTALLOCTYPEZ(pctxt, type) (type*) rtxMemHeapAllocZ (&(pctxt)->pMemHeap, sizeof(type)) |
#define | OSRTREALLOCARRAY(pctxt, pseqof, type) |
#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) |
#define | rtxMemSysAlloc(pctxt, nbytes) rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,nbytes) |
#define | rtxMemAllocZ(pctxt, nbytes) rtxMemHeapAllocZ(&(pctxt)->pMemHeap,nbytes) |
#define | rtxMemSysAllocZ(pctxt, nbytes) rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,nbytes) |
#define | rtxMemRealloc(pctxt, mem_p, nbytes) rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, nbytes) |
#define | rtxMemSysRealloc(pctxt, mem_p, nbytes) rtxMemHeapSysRealloc(&(pctxt)->pMemHeap,(void*)mem_p,nbytes) |
#define | rtxMemFreePtr(pctxt, mem_p) rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemSysFreePtr(pctxt, mem_p) rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemAllocType(pctxt, ctype) (ctype*)rtxMemHeapAlloc(&(pctxt)->pMemHeap,sizeof(ctype)) |
#define | rtxMemSysAllocType(pctxt, ctype) (ctype*)rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,sizeof(ctype)) |
#define | rtxMemAllocTypeZ(pctxt, ctype) (ctype*)rtxMemHeapAllocZ(&(pctxt)->pMemHeap,sizeof(ctype)) |
#define | rtxMemSysAllocTypeZ(pctxt, ctype) (ctype*)rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,sizeof(ctype)) |
#define | rtxMemFreeType(pctxt, mem_p) rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemSysFreeType(pctxt, mem_p) rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemAllocArray(pctxt, n, type) (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), 0) |
#define | rtxMemSysAllocArray(pctxt, n, type) (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), RT_MH_SYSALLOC) |
#define | rtxMemAllocArrayZ(pctxt, n, type) (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), RT_MH_ZEROARRAY) |
#define | rtxMemFreeArray(pctxt, mem_p) rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemSysFreeArray(pctxt, mem_p) rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemReallocArray(pctxt, mem_p, n, type) (type*)rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, sizeof(type)*n) |
#define | rtxMemNewAutoPtr(pctxt, nbytes) rtxMemHeapAlloc(&(pctxt)->pMemHeap, nbytes) |
#define | rtxMemAutoPtrRef(pctxt, ptr) rtxMemHeapAutoPtrRef(&(pctxt)->pMemHeap, (void*)(ptr)) |
#define | rtxMemAutoPtrUnref(pctxt, ptr) rtxMemHeapAutoPtrUnref(&(pctxt)->pMemHeap, (void*)(ptr)) |
#define | rtxMemAutoPtrGetRefCount(pctxt, ptr) rtxMemHeapAutoPtrGetRefCount(&(pctxt)->pMemHeap, (void*)(ptr)) |
#define | rtxMemCheckPtr(pctxt, mem_p) rtxMemHeapCheckPtr(&(pctxt)->pMemHeap, (void*)mem_p) |
#define | rtxMemCheck(pctxt) rtxMemHeapCheck(&(pctxt)->pMemHeap, __FILE__, __LINE__) |
#define | rtxMemPrint(pctxt) rtxMemHeapPrint(&(pctxt)->pMemHeap) |
#define | rtxMemPrintWithFree(pctxt) rtxMemHeapPrintWithFree(&(pctxt)->pMemHeap) |
#define | rtxMemSetProperty(pctxt, propId, pProp) rtxMemHeapSetProperty (&(pctxt)->pMemHeap, propId, pProp) |
Functions | |
void | rtxMemHeapAddRef (void **ppvMemHeap) |
void * | rtxMemHeapAlloc (void **ppvMemHeap, OSSIZE nbytes) |
void * | rtxMemHeapAllocZ (void **ppvMemHeap, OSSIZE nbytes) |
void * | rtxMemHeapSysAlloc (void **ppvMemHeap, OSSIZE nbytes) |
void * | rtxMemHeapSysAllocZ (void **ppvMemHeap, OSSIZE nbytes) |
int | rtxMemHeapCheckPtr (void **ppvMemHeap, const void *mem_p) |
void | rtxMemHeapFreeAll (void **ppvMemHeap) |
void | rtxMemHeapFreePtr (void **ppvMemHeap, void *mem_p) |
void | rtxMemHeapSysFreePtr (void **ppvMemHeap, void *mem_p) |
void * | rtxMemHeapReallocStatic (void **ppvMemHeap, void *mem_p, OSSIZE oldsize, OSSIZE newsize) |
void * | rtxMemHeapRealloc (void **ppvMemHeap, void *mem_p, OSSIZE nbytes_) |
void * | rtxMemHeapSysRealloc (void **ppvMemHeap, void *mem_p, OSSIZE nbytes_) |
void | rtxMemHeapRelease (void **ppvMemHeap) |
void | rtxMemHeapReset (void **ppvMemHeap) |
void | rtxMemHeapSetProperty (void **ppvMemHeap, OSUINT32 propId, void *pProp) |
void * | rtxMemNewArray (OSSIZE nbytes) |
void * | rtxMemNewArrayZ (OSSIZE nbytes) |
void | rtxMemDeleteArray (void *mem_p) |
void * | rtxMemHeapAutoPtrRef (void **ppvMemHeap, void *ptr) |
int | rtxMemHeapAutoPtrUnref (void **ppvMemHeap, void *ptr) |
int | rtxMemHeapAutoPtrGetRefCount (void **ppvMemHeap, void *mem_p) |
void | rtxMemHeapInvalidPtrHook (void **ppvMemHeap, const void *mem_p) |
void | rtxMemHeapCheck (void **ppvMemHeap, const char *file, int line) |
void | rtxMemHeapPrint (void **ppvMemHeap) |
void | rtxMemHeapPrintWithFree (void **ppvMemHeap) |
int | rtxMemHeapCreate (void **ppvMemHeap) |
int | rtxMemHeapCreateExt (void **ppvMemHeap, OSMallocFunc malloc_func, OSReallocFunc realloc_func, OSFreeFunc free_func) |
int | rtxMemStaticHeapCreate (void **ppvMemHeap, void *pmem, OSSIZE memsize) |
int | rtxMemHeapConvertStatic (void **ppvMemHeap, void *pmem, OSSIZE memsize) |
void | rtxMemSetAllocFuncs (OSMallocFunc malloc_func, OSReallocFunc realloc_func, OSFreeFunc free_func) |
void | rtxMemFreeOpenSeqExt (OSCTXT *pctxt, struct OSRTDList *pElemList) |
OSUINT32 | rtxMemHeapGetDefBlkSize (OSCTXT *pctxt) |
void | rtxMemSetDefBlkSize (OSUINT32 blkSize) |
OSUINT32 | rtxMemGetDefBlkSize (OSVOIDARG) |
OSBOOL | rtxMemHeapIsEmpty (OSCTXT *pctxt) |
OSBOOL | rtxMemIsZero (const void *pmem, OSSIZE memsiz) |
void | rtxMemFree (OSCTXT *pctxt) |
void | rtxMemReset (OSCTXT *pctxt) |
void * | rtxMemAllocArray2 (OSCTXT *pctxt, OSSIZE numElements, OSSIZE typeSize, OSUINT32 flags) |
Memory allocation functions and macros handle memory management for the C run-time. Special algorithms are used for allocation and deallocation of memory to improve the run-time performance.
#define ALLOC_ASN1ARRAY | ( | pctxt, | |
pseqof, | |||
type | |||
) |
Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. This version of the macro will return the RTERR_NOMEM error status if the memory request cannot be fulfilled.
pctxt | - Pointer to a context block |
pseqof | - Pointer to a generated SEQUENCE OF array structure. The n member variable must be set to the number of records to allocate. |
type | - Data type of an array record |
#define ALLOC_ASN1ARRAY1 | ( | pctxt, | |
pseqof, | |||
type | |||
) |
Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. This version of the macro will set the internal parameters of the SEQUENCE OF structure to NULL if the memory request cannot be fulfilled.
pctxt | - Pointer to a context block |
pseqof | - Pointer to a generated SEQUENCE OF array structure. The n member variable must be set to the number of records to allocate. |
type | - Data type of an array record |
#define OSRTALLOCTYPE | ( | pctxt, | |
type | |||
) | (type*) rtxMemHeapAlloc (&(pctxt)->pMemHeap, sizeof(type)) |
This macro allocates a single element of the given type.
pctxt | - Pointer to a context block |
type | - Data type of record to allocate |
#define OSRTALLOCTYPEZ | ( | pctxt, | |
type | |||
) | (type*) rtxMemHeapAllocZ (&(pctxt)->pMemHeap, sizeof(type)) |
This macro allocates and zeros a single element of the given type.
pctxt | - Pointer to a context block |
type | - Data type of record to allocate |
#define OSRTREALLOCARRAY | ( | pctxt, | |
pseqof, | |||
type | |||
) |
Reallocate an array. This macro reallocates an array (either expands or contracts) to hold the given number of elements. The number of elements is specified in the n member variable of the pseqof argument.
pctxt | - Pointer to a context block |
pseqof | - Pointer to a generated SEQUENCE OF array structure. The n member variable must be set to the number of records to allocate. |
type | - Data type of an array record |
#define rtxMemAlloc | ( | pctxt, | |
nbytes | |||
) | rtxMemHeapAlloc(&(pctxt)->pMemHeap,nbytes) |
Allocate memory. This macro allocates the given number of bytes. It is similar to the C malloc
run-time function.
pctxt | - Pointer to a context block |
nbytes | - Number of bytes of memory to allocate |
Referenced by OSRTContext::memAlloc().
#define rtxMemAllocArray | ( | pctxt, | |
n, | |||
type | |||
) | (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), 0) |
Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. The pointer to the allocated array is returned to the caller.
pctxt | - Pointer to a context block |
n | - Number of records to allocate |
type | - Data type of an array record |
#define rtxMemAllocArrayZ | ( | pctxt, | |
n, | |||
type | |||
) | (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), RT_MH_ZEROARRAY) |
Allocate a dynamic array and zero memory. This macro allocates a dynamic array of records of the given type and writes zeros over the allocated memory. The pointer to the allocated array is returned to the caller.
pctxt | - Pointer to a context block |
n | - Number of records to allocate |
type | - Data type of an array record |
#define rtxMemAllocType | ( | pctxt, | |
ctype | |||
) | (ctype*)rtxMemHeapAlloc(&(pctxt)->pMemHeap,sizeof(ctype)) |
Allocate type. This macro allocates memory to hold a variable of the given type.
pctxt | - Pointer to a context block |
ctype | - Name of C typedef |
#define rtxMemAllocTypeZ | ( | pctxt, | |
ctype | |||
) | (ctype*)rtxMemHeapAllocZ(&(pctxt)->pMemHeap,sizeof(ctype)) |
Allocate type and zero memory. This macro allocates memory to hold a variable of the given type and initializes the allocated memory to zero.
pctxt | - Pointer to a context block |
ctype | - Name of C typedef |
#define rtxMemAllocZ | ( | pctxt, | |
nbytes | |||
) | rtxMemHeapAllocZ(&(pctxt)->pMemHeap,nbytes) |
Allocate and zero memory. This macro allocates the given number of bytes and then initializes the memory block to zero.
pctxt | - Pointer to a context block |
nbytes | - Number of bytes of memory to allocate |
Referenced by OSRTContext::memAllocZ().
#define rtxMemAutoPtrGetRefCount | ( | pctxt, | |
ptr | |||
) | rtxMemHeapAutoPtrGetRefCount(&(pctxt)->pMemHeap, (void*)(ptr)) |
This function returns the reference count of the given pointer. goes to zero, the memory is freed.
pctxt | Pointer to a context structure. |
ptr | Pointer on which reference count is to be fetched. |
#define rtxMemAutoPtrRef | ( | pctxt, | |
ptr | |||
) | rtxMemHeapAutoPtrRef(&(pctxt)->pMemHeap, (void*)(ptr)) |
This function increments the auto-pointer reference count.
pctxt | Pointer to a context structure. |
ptr | Pointer on which reference count is to be incremented. |
#define rtxMemAutoPtrUnref | ( | pctxt, | |
ptr | |||
) | rtxMemHeapAutoPtrUnref(&(pctxt)->pMemHeap, (void*)(ptr)) |
This function decrements the auto-pointer reference count. If the count goes to zero, the memory is freed.
pctxt | Pointer to a context structure. |
ptr | Pointer on which reference count is to be decremented. |
#define rtxMemCheck | ( | pctxt | ) | rtxMemHeapCheck(&(pctxt)->pMemHeap, __FILE__, __LINE__) |
Check memory heap.
pctxt | - Pointer to a context block |
#define rtxMemCheckPtr | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapCheckPtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Check memory pointer. This macro check pointer on presence in heap.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block. |
#define rtxMemFreeArray | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Free memory pointer. This macro frees memory at the given pointer. The memory must have been allocated using the rtxMemAlloc (or similar) macros or the rtxMem memory allocation macros. This macro is similar to the C free
function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemAlloc or rtxMemAlloc macro or the rtxMemHeapAlloc function. |
#define rtxMemFreePtr | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Free memory pointer. This macro frees memory at the given pointer. The memory must have been allocated using the rtxMemAlloc (or similar) macros or the rtxMem memory allocation macros. This macro is similar to the C free
function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemAlloc macro or the rtxMemHeapAlloc function. |
Referenced by OSRTContext::memFreePtr().
#define rtxMemFreeType | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Free memory pointer. This macro frees memory at the given pointer. The memory must have been allocated using the rtxMemAlloc (or similar) macros or the rtxMem memory allocation macros. This macro is similar to the C free
function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemAlloc or rtxMemAlloc macro or the rtxMemHeapAlloc function. |
#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. The rtxMemAutoPtrRef
and rtxMemAutoPtrUnref
functions can be used to increment and decrement the reference count. When the count goes to zero, the memory held by the pointer is freed.
pctxt | Pointer to a context structure. |
nbytes | Number of bytes to allocate. |
#define rtxMemPrint | ( | pctxt | ) | rtxMemHeapPrint(&(pctxt)->pMemHeap) |
Print memory heap structure to stderr.
pctxt | - Pointer to a context block |
#define rtxMemPrintWithFree | ( | pctxt | ) | rtxMemHeapPrintWithFree(&(pctxt)->pMemHeap) |
Print memory heap structure to stderr, the same as rtxMemPrint, but add details about the memory free list.
pctxt | - Pointer to a context block |
#define rtxMemRealloc | ( | pctxt, | |
mem_p, | |||
nbytes | |||
) | rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, nbytes) |
Reallocate memory. This macro reallocates a memory block (either expands or contracts) to the given number of bytes. It is similar to the C realloc
run-time function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to reallocate. This must have been allocated using the rtxMemAlloc macro or the rtxMemHeapAlloc function. |
nbytes | - Number of bytes of memory to which the block is to be resized. |
Referenced by OSRTContext::memRealloc().
#define rtxMemReallocArray | ( | pctxt, | |
mem_p, | |||
n, | |||
type | |||
) | (type*)rtxMemHeapRealloc(&(pctxt)->pMemHeap, (void*)mem_p, sizeof(type)*n) |
Reallocate memory. This macro reallocates a memory block (either expands or contracts) to the given number of bytes. It is similar to the C realloc
run-time function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to reallocate. This must have been allocated using the rtxMemAlloc macro or the rtxMemHeapAlloc function. |
n | - Number of items of the given type to be allocated. |
type | - Array element data type (for example, int). |
#define rtxMemSetProperty | ( | pctxt, | |
propId, | |||
pProp | |||
) | rtxMemHeapSetProperty (&(pctxt)->pMemHeap, propId, pProp) |
Set memory heap property.
pctxt | - Pointer to a context block |
propId | - Property Id. |
pProp | - Pointer to property value. |
#define rtxMemSysAlloc | ( | pctxt, | |
nbytes | |||
) | rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,nbytes) |
This macro makes a direct call to the configured system memory allocation function. By default, this is the C malloc function, but it is possible to configure to use a custom allocation function.
pctxt | - Pointer to a context block |
nbytes | - Number of bytes of memory to allocate |
#define rtxMemSysAllocArray | ( | pctxt, | |
n, | |||
type | |||
) | (type*)rtxMemAllocArray2 (pctxt, n, sizeof(type), RT_MH_SYSALLOC) |
Allocate a dynamic array. This macro allocates a dynamic array of records of the given type. The pointer to the allocated array is returned to the caller.
This macro makes a direct call to the configured system memory allocation function. By default, this is the C malloc function, but it is possible to configure to use a custom allocation function.
pctxt | - Pointer to a context block |
n | - Number of records to allocate |
type | - Data type of an array record |
#define rtxMemSysAllocType | ( | pctxt, | |
ctype | |||
) | (ctype*)rtxMemHeapSysAlloc(&(pctxt)->pMemHeap,sizeof(ctype)) |
Allocate type. This macro allocates memory to hold a variable of the given type.
This macro makes a direct call to the configured system memory allocation function. By default, this is the C malloc function, but it is possible to configure to use a custom allocation function.
pctxt | - Pointer to a context block |
ctype | - Name of C typedef |
#define rtxMemSysAllocTypeZ | ( | pctxt, | |
ctype | |||
) | (ctype*)rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,sizeof(ctype)) |
Allocate type and zero memory. This macro allocates memory to hold a variable of the given type and initializes the allocated memory to zero.
This macro makes a direct call to the configured system memory allocation function. By default, this is the C malloc function, but it is possible to configure to use a custom allocation function.
pctxt | - Pointer to a context block |
ctype | - Name of C typedef |
#define rtxMemSysAllocZ | ( | pctxt, | |
nbytes | |||
) | rtxMemHeapSysAllocZ(&(pctxt)->pMemHeap,nbytes) |
Allocate and zero memory. This macro allocates the given number of bytes and then initializes the memory block to zero.
This macro makes a direct call to the configured system memory allocation function. By default, this is the C malloc function, but it is possible to configure to use a custom allocation function.
pctxt | - Pointer to a context block |
nbytes | - Number of bytes of memory to allocate |
#define rtxMemSysFreeArray | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Free memory pointer. This macro frees memory at the given pointer. The memory must have been allocated using the rtxMemSysAlloc (or similar) macros or the rtxMemSys memory allocation macros. This macro is similar to the C free
function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemSysAlloc or rtxMemSysAlloc macro or the rtxMemSysHeapAlloc function. |
#define rtxMemSysFreePtr | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
This macro makes a direct call to the configured system memory free function. By default, this is the C free function, but it is possible to configure to use a custom free function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemSysAlloc macro or the rtxMemHeapSysAlloc function. |
#define rtxMemSysFreeType | ( | pctxt, | |
mem_p | |||
) | rtxMemHeapSysFreePtr(&(pctxt)->pMemHeap, (void*)mem_p) |
Free memory pointer. This macro frees memory at the given pointer. The memory must have been allocated using the rtxMemSysAlloc (or similar) macros or the rtxMemSys memory allocation macros. This macro is similar to the C free
function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to free. This must have been allocated using the rtxMemSysAlloc or rtxMemSysAlloc macro or the rtxMemSysHeapAlloc function. |
#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.. By default, this is the C realloc function, but it is possible to configure to use a custom reallocation function.
pctxt | - Pointer to a context block |
mem_p | - Pointer to memory block to reallocate. This must have been allocated using the rtxMemSysAlloc macro or the rtxMemHeapSysAlloc function. |
nbytes | - Number of bytes of memory to which the block is to be resized. |
void rtxMemFree | ( | OSCTXT * | pctxt | ) |
Free memory associated with a context. This macro frees all memory held within a context. This is all memory allocated using the rtxMemAlloc (and similar macros) and the rtxMem memory allocation functions using the given context variable.
pctxt | - Pointer to a context block |
Referenced by OSRTContext::memFreeAll().
OSUINT32 rtxMemGetDefBlkSize | ( | OSVOIDARG | ) |
This function returns the actual granularity of memory blocks.
int rtxMemHeapConvertStatic | ( | void ** | ppvMemHeap, |
void * | pmem, | ||
OSSIZE | memsize | ||
) |
This function converts a standard memory heap to a static memory heap. All allocations are done from the static block of memory that is provided. It is much faster than the standard management but has some limitations such as the inability to free individual pointer values. All memory in the block must be freed at once.
If memory was previously allocated using the given heap, it will be freed before conversion.
ppvMemHeap | Pointer-to-pointer to heap variable. ppvMemHeap and *ppvMemHeap must not be null; otherwise, an error is returned. |
pmem | Pointer to static memory block to use for allocations. |
memsize | Sizeof the memory block in bytes. |
int rtxMemHeapCreate | ( | void ** | ppvMemHeap | ) |
This function creates a standard memory heap. It is invoked internally from the rtxInitContext function to create the heap in the context.
ppvMemHeap | Pointer-to-pointer to variable to receive created object. |
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. It is invoked internally from the rtxInitContextExt function to create the heap in the context.
ppvMemHeap | Pointer-to-pointer to variable to receive created object. |
malloc_func | Pointer to memory allocation function. |
realloc_func | Pointer to memory reallocation function. |
free_func | Pointer to memory free function. |
OSUINT32 rtxMemHeapGetDefBlkSize | ( | OSCTXT * | pctxt | ) |
This function returns the actual granularity of memory blocks in the context.
pctxt | Pointer to a context block. |
OSBOOL rtxMemHeapIsEmpty | ( | OSCTXT * | pctxt | ) |
This function determines if the memory heap defined in the give context is empty (i.e. contains no outstanding memory allocations).
pctxt | Pointer to a context block. |
void rtxMemHeapPrint | ( | void ** | ppvMemHeap | ) |
Print details about the memory heap.
void rtxMemHeapPrintWithFree | ( | void ** | ppvMemHeap | ) |
Print the same details about the memory heap as rtxMemHeapPrint but add deatils about the free memory list.
OSBOOL rtxMemIsZero | ( | const void * | pmem, |
OSSIZE | memsiz | ||
) |
This helper function determines if an arbitrarily sized block of memory is set to zero.
pmem | Pointer to memory block to check |
memsiz | Size of the memory block |
void rtxMemReset | ( | OSCTXT * | pctxt | ) |
Reset memory associated with a context. This macro resets all memory held within a context. This is all memory allocated using the rtxMemAlloc (and similar macros) and the rtxMem memory allocation functions using the given context variable.
The difference between this and the OSMEMFREE macro is that the memory blocks held within the context are not actually freed. Internal pointers are reset so the existing blocks can be reused. This can provide a performace improvement for repetitive tasks such as decoding messages in a loop.
pctxt | - Pointer to a context block |
Referenced by OSRTContext::memReset().
void rtxMemSetAllocFuncs | ( | OSMallocFunc | malloc_func, |
OSReallocFunc | realloc_func, | ||
OSFreeFunc | free_func | ||
) |
This function sets the pointers to standard allocation functions. These functions are used to allocate/reallocate/free memory blocks. By default, standard C functions - 'malloc', 'realloc' and 'free' - are used. But if some platforms do not support these functions (or some other reasons exist) they can be overloaded. The functions being overloaded should have the same prototypes as the standard functions.
malloc_func | Pointer to the memory allocation function ('malloc' by default). |
realloc_func | Pointer to the memory reallocation function ('realloc' by default). |
free_func | Pointer to the memory deallocation function ('free' by default). |
void rtxMemSetDefBlkSize | ( | OSUINT32 | blkSize | ) |
This function sets the minimum size and the granularity of memory blocks for newly created memory heaps.
blkSize | The minimum size and the granularity of memory blocks. |
int rtxMemStaticHeapCreate | ( | void ** | ppvMemHeap, |
void * | pmem, | ||
OSSIZE | memsize | ||
) |
This function creates a static memory heap. All allocations are done from the static block of memory that is provided. It is much faster than the standard management but has some limitations such as the inability to free individual pointer values. All memory in the block must be freed at once.
Note: rtxMemHeapConvertStatic is generally preferrable to rtxMemStaticHeapCreate, since in most cases you will already have a heap object that you can reuse.
ppvMemHeap | Pointer-to-pointer to variable to receive created object. |
pmem | Pointer to static memory block to use for allocations. |
memsize | Sizeof the memory block in bytes. |