Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

The memory manager information page

The memory manager is a class that handles memory (de)allocation requests.
This class works like a wrapper between the actual C memory allocation functions (*alloc, free) and the memory (de)allocation requests of the application.
Why would such a class be needed? First of all, because we had some major issues with memory getting misued (read: deleted) over DLL boundaries. One thing this memory manager does is solve the problem by allocating all the memory in the OgreMain.dll/so process.
Another use would be leak detection and memory misuse detection. With a custom memory manager, calls to new/delete and *alloc/free could be overseed and logged.
Yet another use is the optimization of memory allocation for certain object types. One of the most common examples is a small object allocator.

There actually are two classes, one is the standard memory manager which only addresses memory allocation problems when deallocating across processes.

The other is a modified version of the debugging memory manager written by Paul 'MidNight' Nettle (aka. the Fluid Studios Memory Manager). Obviously, the second one should be used only when debugging your application as it adds some visible overhead.
You can switch between the two memory managers by setting the value of the OGRE_DEBUG_MEMORY_MANAGER macro in OgreConfig.h

The class contains a static member of type MemoryManager. That is because we want the memory manager to be created even before we override the new([])/delete([]) operators.

Paul Nettle's Memory Manager page at flipCode - you can get the original source form here.


Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:38:00 2006