Data Fields | |
| void *(* | rwmalloc )(size_t size, RwUInt32 hint) |
| void(* | rwfree )(void *mem) |
| void *(* | rwrealloc )(void *mem, size_t newSize, RwUInt32 hint) |
| void *(* | rwcalloc )(size_t numObj, size_t sizeObj, RwUInt32 hint) |
All RenderWare Graphics memory-management functions that allocate memory take an additional RwUInt32 parameter which is a memory hint. The main purpose of the hints is to help improve memory management, such as preventing memory fragmentation. To use the memory hints, you should have provided your own memory-management function through the RwEngineInit() function. For example, you might want to have a separate memory heap just for the RwMatrix or RpGeometry objects, or a separate heap for all temporary allocations inside RenderWare Graphics. As always, memory-management is very specific to each application and has to be organized and tuned for each one.
A memory hint contains the following information: RwMemoryHintDuration, RwMemoryHintFlag and chunkID. ChunkID is the id of either the object for which a memory request came, or of the module a call for allocation belongs to. Refer to RwCorePluginID for a list of all object IDs and to RwEngine, RwCriterionCoreID and RwCriterionWorldID for a list of all module IDs. You can extend all of these fields using specific values for duration, object IDs, flags and create custom hints that can be passed to all the memory allocation calls you make. A tipical call to RwMalloc looks like:
RwMalloc(size, rwID_MATRIX | rwMEMHINTDUR_FUNCTION);
|
|
Allocates an array in memory with elements initialized to 0.
|
|
|
Deallocates or frees a memory block.
|
|
|
Allocates memory blocks.
|
|
|
Reallocate memory blocks.
|
© 1993-2004 Criterion Software Limited. All rights reserved. Built Thu Feb 12 13:46:48 2004.
Send Feedback