#include <stddef.h>
Go to the source code of this file.
Compounds | |
| struct | MeMemoryAPI |
| struct | MeMemoryOptions |
| struct | MeMemoryStats |
Defines | |
| #define | MeMemoryALLOCA(n) ((*MeMemoryAPI.create)(n)) |
| Stack allocation. More... | |
| #define | MeMemoryFREEA(b) ((*MeMemoryAPI.destroy)(b)) |
| Stack deallocation. More... | |
| #define | MeMemoryAVAILABLE 1 |
| This flag allows testing whether the API is being used. | |
Enumerations | |
| enum | MeMemoryAllocation { MeMemoryAny = 0, MeMemorySegment, MeMemoryBIBOP, MeMemoryBTag, MeMemoryBitmap, MeMemoryBuddy, MeMemoryArrays, MeMemoryPools } |
| Type of memory allocation implementation. More... | |
| enum | MeMemoryReclamation { MeMemoryManual = 0, MeMemoryNone, MeMemoryStack, MeMemoryRefCount, MeMemoryGC, MeMemoryGCCompacting, MeMemoryGCCopying, MeMemoryGCAged } |
| Type of memory reclamation policy. More... | |
Functions | |
| void | MeMemoryPrintOptions (const struct MeMemoryOptions *const options) |
Print an MeMemory option record. More... | |
| void | MeMemoryPrintStats (const struct MeMemoryStats *const stats) |
Print an MeMemory statistics record. More... | |
| void | MeMemorySetDefaults (struct MeMemoryOptions *const opts) |
| Set the options passed to some sort of default, vanilla, values. | |
Variables | |
| struct MeMemoryAPI | MeMemoryAPI |
| The table of memory manager entry points. More... | |
| unsigned | MeMemoryDoTrace = 0 |
| If nonzero, trace API calls if tracing is enabled. | |
| unsigned | MeMemoryDoStats = 1 |
| If nonzero, keep statistics if statistics have been enabled. | |
This API allows a library to use an external memory manager, via a a set of function pointers with predefined semantics.
It also allows a library to give hints as to what kind of memory management it prefers; the memory manager may or may not heed such advice.
It is expected that the debug version of the memory managers will perform extensive checks, like verifying redzones around each block.
|
Stack allocation.
If the compiler supports stack allocation (GNU C or MS C) then the relevant compiler intrinsics are used. Otherwise it uses heap allocation, which is why a FREEA function is needed too, and you must use it.
|
Stack deallocation.
If the compiler supports stack allocation (GNU C or MS C) then this does nothing. Otherwise heap allocation has been used and this just destroys the heap allocated block.
|
Initializer:
\
((void *) ((((long unsigned) (void *) (a)) + 15) &~ 15))
|
Initializer:
\
void *name##Addr = \
MeMemoryALLOCA(((n) * sizeof (type)) + 16); \
type *name = (type *) MeMemoryQUADALIGN(name##Addr);
|
Initializer:
\
MeMemoryFREEA(name##Addr)
|
Type of memory allocation implementation.
|
Type of memory reclamation policy.
|
Print an MeMemory option record.
This function prints, using the MeInfo entry point of the MeMessage library, the contents of a MeMemoryOptions record.
| options |
A pointer to a MeMemory options record. |
|
Print an MeMemory statistics record.
This function prints, using the MeInfo entry point of the MeMessage library, the contents of a MeMemoryStats record.
| options |
A pointer to a MeMemory statistics record. |
|
The table of memory manager entry points.
This table is usually initialised using one of the memory manager specific function tables, for example MeMemoryAPIArrays or MeMemoryAPIMalloc.
Copyright MathEngine PLC 2000, all rights reserved.