Assertion with ETM demo and current Ogre SVN Version

Crash

22-08-2008 15:20:29

Hi all,

I just updated my SVN version of Ogre. Now, in debug mode, the ETM demo (and also my project using ETM) throws an assertion during startup. With the help of message boxes I came to the conclusion that it must come from createTerrainLightmap().
Here is the output:


---------------------------
Microsoft Visual C++ Runtime Library
---------------------------
Assertion failed!

Program: ...
File: g:\c++\bibliotheken\ogre\ogremai...\ogreme...ker.cpp
Line: 70

Expression: 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"

For information on how your program can cause an assertion
failure, see the Visual C++ documentation on asserts

(Press Retry to debug the application - JIT must be enabled)
---------------------------
Abbrechen Wiederholen Ignorieren
---------------------------


Hope someone can help :)

CABAListic

22-08-2008 19:57:17

I've just investigated this, it's a problem with Ogre's new memory managers. To fix it, you need to open ETLightmap.cpp and find line 288 which reads:

uchar* lightMap = new uchar[width*height * 3];


Change this to:

uchar* lightMap = OGRE_ALLOC_T(uchar, width*height*3, MEMCATEGORY_GENERAL);

Crash

23-08-2008 00:06:57

Wow thanks for the fast answer! Works perfectly :)