Rtmem |
Defines | |
#define | memAlloc(pctxt, nbytes) memHeapAlloc(&(pctxt)->pTypeMemHeap,nbytes) |
Allocate memory. | |
#define | memAllocZ(pctxt, nbytes) memHeapAllocZ(&(pctxt)->pTypeMemHeap,nbytes) |
Allocate and zero memory. | |
#define | memAllocType(pctxt, ctype) (ctype*)memHeapAlloc(&(pctxt)->pTypeMemHeap,sizeof(ctype)) |
Allocate type. | |
#define | memAllocTypeZ(pctxt, ctype) (ctype*)memHeapAllocZ(&(pctxt)->pTypeMemHeap,sizeof(ctype)) |
Allocate type and zero memory. | |
#define | memRealloc(pctxt, mem_p, nbytes) memHeapRealloc(&(pctxt)->pTypeMemHeap, (void*)mem_p, nbytes) |
Reallocate memory. | |
#define | memFreePtr(pctxt, mem_p) |
Free memory pointer. | |
#define | memFree(pctxt) memHeapFreeAll(&(pctxt)->pTypeMemHeap) |
Free memory associated with a context. | |
#define | memReset(pctxt) memHeapReset(&(pctxt)->pTypeMemHeap) |
Reset memory associated with a context. | |
#define | OSCDECL |
Typedefs | |
typedef void *OSCDECL * | OSMallocFunc (size_t size) |
typedef void *OSCDECL * | OSReallocFunc (void *ptr, size_t size) |
Functions | |
typedef | void (OSCDECL *OSFreeFunc)(void *ptr) |
EXTERN void | memHeapAddRef (void **ppvMemHeap) |
EXTERN void * | memHeapAlloc (void **ppvMemHeap, int nbytes) |
EXTERN void * | memHeapAllocZ (void **ppvMemHeap, int nbytes) |
EXTERN int | memHeapCheckPtr (void **ppvMemHeap, void *mem_p) |
EXTERN int | memHeapCreate (void **ppvMemHeap) |
EXTERN void | memHeapFreeAll (void **ppvMemHeap) |
EXTERN void | memHeapFreePtr (void **ppvMemHeap, void *mem_p) |
EXTERN void * | memHeapRealloc (void **ppvMemHeap, void *mem_p, int nbytes_) |
EXTERN void | memHeapRelease (void **ppvMemHeap) |
EXTERN void | memHeapReset (void **ppvMemHeap) |
EXTERN void * | memHeapMarkSaved (void **ppvMemHeap, const void *mem_p, ASN1BOOL saved) |
EXTERN void | memHeapSetProperty (void **ppvMemHeap, ASN1UINT propId, void *pProp) |
EXTERN void | memSetAllocFuncs (OSMallocFunc malloc_func, OSReallocFunc realloc_func, OSFreeFunc free_func) |
This function sets the pointers to standard allocation functions. | |
EXTERN void | memFreeOpenSeqExt (OOCTXT *pctxt, DList *pElemList) |
EXTERN void | memHeapSetFlags (OOCTXT *pctxt, ASN1UINT flags) |
EXTERN void | memHeapClearFlags (OOCTXT *pctxt, ASN1UINT flags) |
EXTERN void | memHeapSetDefBlkSize (OOCTXT *pctxt, ASN1UINT blkSize) |
This function sets the pointer to standard allocation functions. | |
EXTERN ASN1UINT | memHeapGetDefBlkSize (OOCTXT *pctxt) |
This function returns the actual granularity of memory blocks. |
#define memAlloc | ( | pctxt, | |||
nbytes | ) | memHeapAlloc(&(pctxt)->pTypeMemHeap,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 |
#define memAllocZ | ( | pctxt, | |||
nbytes | ) | memHeapAllocZ(&(pctxt)->pTypeMemHeap,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 |
#define memAllocType | ( | pctxt, | |||
ctype | ) | (ctype*)memHeapAlloc(&(pctxt)->pTypeMemHeap,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 memAllocTypeZ | ( | pctxt, | |||
ctype | ) | (ctype*)memHeapAllocZ(&(pctxt)->pTypeMemHeap,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 memRealloc | ( | pctxt, | |||
mem_p, | |||||
nbytes | ) | memHeapRealloc(&(pctxt)->pTypeMemHeap, (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 memHeapAlloc macro or the memHeapAlloc function. | |
nbytes | - Number of bytes of memory to which the block is to be resized. |
#define memFreePtr | ( | pctxt, | |||
mem_p | ) |
Value:
if (memHeapCheckPtr (&(pctxt)->pTypeMemHeap, (void*)mem_p)) \ memHeapFreePtr(&(pctxt)->pTypeMemHeap, (void*)mem_p)
This macro frees memory at the given pointer. The memory must have been allocated using the memHeapAlloc (or similar) macros or the mem 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 memHeapAlloc or memAlloc macro or the memHeapAlloc function. |
#define memFree | ( | pctxt | ) | memHeapFreeAll(&(pctxt)->pTypeMemHeap) |
Free memory associated with a context.
This macro frees all memory held within a context. This is all memory allocated using the memHeapAlloc (and similar macros) and the mem memory allocation functions using the given context variable.
pctxt | - Pointer to a context block |
#define memReset | ( | pctxt | ) | memHeapReset(&(pctxt)->pTypeMemHeap) |
Reset memory associated with a context.
This macro resets all memory held within a context. This is all memory allocated using the memHeapAlloc (and similar macros) and the mem memory allocation functions using the given context variable.
The difference between this and the ASN1MEMFREE 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 |
EXTERN void memSetAllocFuncs | ( | 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 the 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 standard ones.
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). |
This function sets the pointer to standard allocation functions.
These functions are used to allocate/reallocate/free the 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 standard ones.
pctxt | Pointer to a context block. | |
blkSize | The currently used minimum size and the granularity of memory blocks. |
This function returns the actual granularity of memory blocks.
pctxt | Pointer to a context block. |