#include <MeMemory.h>
Public Attributes | |
| void (* | setOptions )(const struct MeMemoryOptions *const options) |
| Set memory manager API options. More... | |
| void (* | getOptions )(struct MeMemoryOptions *const options) |
| Get memory manager API options. More... | |
| void (* | init )(void *const arena,const size_t bytes,...) |
| Initialize the memory manager. More... | |
| void* (* | create )(size_t bytes,...) |
| Allocate a block of at least that given size. More... | |
| void* (* | resize )(void *block,size_t bytes,...) |
| Change the size of a block, possibly moving it. More... | |
| void (* | incRef )(const void *const block) |
| Increment the in-use count of a block. More... | |
| void (* | decRef )(const void *const block) |
| Decrement the in-use count of a block. More... | |
| void (* | destroy )(void *const block,...) |
| Reduce the in-use count of a block to zero. More... | |
| void (* | getStats )(struct MeMemoryStats *const stats) |
| Obtain a copy of the usage statistics of the memory manager API. More... | |
| void (* | term )() |
| Terminate memory manager API operation. More... | |
Each memory manager usable via this API will come with a set of API compliant wrapper functions, that will be packaged in a 'struct' similar to this one. At program startup copy that into the canonical one called 'MeMemoryAPI' to initialise it.
|
Allocate a block of at least that given size.
If there are any options (form example for placement) then these can be specified after the size, but this will be highly unportable.
The in-use count of the newly created block will be one.
|
Decrement the in-use count of a block.
This function may actually do nothing.
|
Reduce the in-use count of a block to zero.
This function may actually do nothing, for example when the memory manager does automatic reclamation via garbage collection.
|
Get memory manager API options.
Returns the memory manager options that have been set.
|
Obtain a copy of the usage statistics of the memory manager API.
The statistics returned may be incomplete, depending on how many are supported by the memory manager itself. It can be called after setOptions and before init to
|
Increment the in-use count of a block.
This function may actually do nothing.
|
Initialize the memory manager.
Allows memory manager initialisation. You should first call setOptions to inform the API what kind of memory manager is desirable, and getStats to see what kind of memory arena size the API thinks that requires.
Then, if necessary, allocate that size (or something else) and pass it the allocate arena to this function.
|
Change the size of a block, possibly moving it.
If there are any options (form example for placement) then these can be specified after the size, but this will be highly unportable.
This function may fail as it may be unavailable under some memory managers, or the specific resizing may be impossible or unsupported. In particular resizing to a smaller size may be forbidden, or resizing to a larger one may not be feasible.
|
Set memory manager API options.
Use this to setup the memory manager API with hints as to what kind of memory manager and policy it should select.
|
Terminate memory manager API operation.
Invoking this will often be needed in order to collect some types of statistics. It also will often check that usage of the API has been correct, e.g. that the number of calls to incRef and to decRef has been the same.
Copyright MathEngine PLC 2000, all rights reserved.