The memory manager.
More...
#include <mlMemoryManager.h>
The memory manager.
Definition at line 86 of file mlMemoryManager.h.
◆ Ownership
| Enumerator |
|---|
| UserDataOwnershipStaysWithCaller | |
| UserDataOwnershipGoesToMemoryBlock | |
Definition at line 212 of file mlMemoryManager.h.
◆ ~MLMemoryManager()
| MLMemoryManager::~MLMemoryManager |
( |
| ) |
|
◆ clearMemoryBlockHandles() [1/2]
| void MLMemoryManager::clearMemoryBlockHandles |
( |
MLMemoryBlockHandle ** | handles, |
|
|
size_t | handleCount ) |
Clears a list of memory block handles. The cache access mutex will be locked only once. NULL pointers are allowed in handles; they will be ignored.
◆ clearMemoryBlockHandles() [2/2]
Clears a list of weak memory block handles. The cache access mutex will be locked only once. NULL pointers are allowed in handles; they will be ignored.
◆ deinitialize()
| void MLMemoryManager::deinitialize |
( |
| ) |
|
|
static |
Deinitializes the memory manager. This function should be called at program termination, when no library accesses the memory manager anymore. This also means that no strong or weak handle may exist at this time; otherwise, they would be destroyed after the memory manager and try to communicate with it, causing a crash. Calling deinitialize() multiple times is allowed.
◆ deregisterDeletionCallbackUnsafe()
◆ getCacheAccessMutex()
| boost::mutex & MLMemoryManager::getCacheAccessMutex |
( |
| ) |
|
Advanced memory manager handling. Returns the cache access mutex. Make sure you know what you are doing when using this mutex!
◆ initialize()
| void MLMemoryManager::initialize |
( |
| ) |
|
|
static |
Initializes the memory manager with a default limit of one gigabyte for the joint size of the cache and the locked memory. Calling this function more than once is allowed and has no effect. Deinitialization can be done by calling deinitialize(), which is also automatically called when the memory manager library is unloaded. The default cache and locked memory size limit can be adjusted with setCacheAndLockedMemorySizeLimit.
◆ registerDeletionCallbackUnsafe()
◆ registerLibrary()
| unsigned int MLMemoryManager::registerLibrary |
( |
const std::string & | libraryName | ) |
|
Registers a library and returns an ID. This ID must be passed to allocate() and addAllocatedMemory(), and is used for generating statistics about cache and locked memory usage of different libraries.
◆ replaceDeletionCallback()
Replaces the deletion callback and user data that are registered for the memory block. IMPORTANT: The cache access mutex must be locked before calling this function! handles that reference the same memory block.
- Deprecated
- use registerDeletionCallbackUnsafe/deregisterDeletionCallbackUnsafe instead
◆ setErrorHandlingCallback()
◆ singleton()
The singleton is the only way to communicate with the memory manager. The pointer may never be deleted, this is handled in the deinitialization.
The documentation for this class was generated from the following file: