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

## The memory manager information page

### Description

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.

### Manager types

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

### Implementation Note

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.

### See also

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

Copyright © 2002-2003 by The OGRE Team
Last modified Sun Nov 28 19:48:57 2004