Caelum - Ogre1.6.0 - MemoryTracker Assert


10-11-2008 02:40:04


The new MemoryTracker feature in Ogre 1.6.0 is asserting when Caelum attempts to release materials in FlatCloudLayer::~FlatCloudLayer(). The relevant line is:

// Destroy material.

Following is the call stack trace:

#0 69F67AD1 Ogre::MemoryTracker::_recordDealloc(this=0x6a4fc8a0, ptr=0x1704bf90) (OgreMain/src/OgreMemoryTracker.cpp:72)
#1 6A2817EE Ogre::StdAllocPolicy::deallocateBytes(ptr=0x1704bf90) (../include/OgreMemoryStdAlloc.h:70)
#3 69EF4139 Ogre::Image::~Image(this=0x1704bf90) (OgreMain/src/OgreImage.cpp:74)
#4 02EA5E68 std::auto_ptr<Ogre::Image>::~auto_ptr(this=0x170fa2c0) (C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/memory:260)
#5 02E44814 Caelum::FlatCloudLayer::~FlatCloudLayer(this=0x170fa288) (Caelum/src/FlatCloudLayer.cpp:104)
#6 02E3A577 Caelum::CloudSystem::clearLayers(this=0x1704afa8) (Caelum/src/CloudSystem.cpp:52)
#7 02E3A6AC Caelum::CloudSystem::~CloudSystem(this=0x1704afa8) (Caelum/src/CloudSystem.cpp:59)
#8 02EA5ECB std::auto_ptr<Caelum::CloudSystem>::reset(this=0x170bc370, __p=0x0) (C:/Program Files/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/memory:334)
#9 02E75C7D Caelum::CaelumSystem::setCloudSystem(this=0x170bc2e0, value=0x0) (../include/CaelumSystem.h:426)
#10 02E342C1 Caelum::CaelumSystem::destroySubcomponents(this=0x170bc2e0, destroyEverything=true) (Caelum/src/CaelumSystem.cpp:85)
#11 02E350FD Caelum::CaelumSystem::~CaelumSystem(this=0x170bc2e0) (Caelum/src/CaelumSystem.cpp:103)
#12 00405210 MMOnster::MMOnsterApplication::destroyCaelum(this=0x3cad418)

If I disable MemoryTracker there is no assert thrown, of course.

Ogre: 1.6.0 pulled from trunk @ Rev 8157
Caelum: 0.4.0 pulled from trunk @ Rev 350
Compiler: MinGW


13-11-2008 12:56:38


I'm not getting this error when compiling with MSVC2005. I'm suspecting stale resources or perhaps my Code::Blocks MinGW configuration is borked. Stay tuned while I sweep the floor.....


14-11-2008 04:19:50

I did a clean sweep on all of my code, refreshed all of the dependencies, and I'm still getting the error in C::B + MinGW.


20-11-2008 09:57:19

So this only happens with MinGW; not MSVC? I assume you built your own C::B project files for Caelum; maybe there are some broken settings in there.

Can you tell what the assertion message is? Is it a double free? Also; can you check if it also happens in demos included with Caelum?


20-11-2008 17:26:53

Code::Blocks converted the MSVC project file into a C::B project file. I have not tried creating the C::B project file from scratch, but I can do that. I'll try building the Caelum demos tonight with C::B + MinGW.

The assertion reads:

Assertion failed!
OgreMemoryTracker.cpp line: 70

i != mAllocations.end() && "Unable to locate allocation unit - " "this probably means you have a mismatched allocation / deallocation style, " "check if you're are using OGRE_ALLOC_T / OGRE_FREE and OGRE_NEW_T / OGRE_DELETE_T consistently"


21-11-2008 07:53:33

I have tested Caelum against the Ogre memory tracker in both windows/MSVC 9.0 and linux/g++ 4.3 and it seems to work fine.

That assertion claims there was an allocator mismatch for the data buffer inside Ogre::Image. Caelum doesn't touch that. Perhaps you compiled Ogre with a strange combination of image codecs and found a bug in image loading?


23-11-2008 05:11:48

I get the same error when running the Caelum demo. I'm using the C::B project file that ships with Ogre to build Ogre. I'll dig into the Ogre C::B project file and see if something is stale in there.