Game Development Community

Windows Crash On Mission End With Torque_disable_memory_manager

by Stephane Conde · in Torque Game Engine · 10/26/2006 (5:06 am) · 2 replies

When the TORQUE_DISABLE_MEMORY_MANAGER preprocessor directive is defined, I get a crash on mission end in Windows.

The crash happens everytime when the MissionCleanup group is deleted in the endMission() script function. The crash happens with different objects and in different functions, but always when MissionCleanup is being deleted.

More specifically, the crash seems to always happen when a ShapeBase object inside of the MissionCleanup object is deleted.

cont'd...

#1
10/26/2006 (5:06 am)
...cont'd

Here is an example back-trace (this is the most re-occurring back-trace):

...
ntdll.dll!7c926abe() 	
Torque_DEBUG.exe!free(void * pBlock=0x01370000)  Line 103	C
ntdll.dll!7c94a5d0() 	
ntdll.dll!7c9268ad() 	
Torque_DEBUG.exe!free(void * pBlock=0x067abe88)  Line 103	C
Torque_DEBUG.exe!dFree(void * in_pFree=0x067abe88)  Line 1359 + 0x9	C++
Torque_DEBUG.exe!Vector<MatrixF>::~Vector<MatrixF>()  Line 158 + 0xc	C++
Torque_DEBUG.exe!TSShapeInstance::~TSShapeInstance()  Line 116 + 0xb4	C++
Torque_DEBUG.exe!TSShapeInstance::'scalar deleting destructor'()  + 0x2b	C++
Torque_DEBUG.exe!ShapeBase::~ShapeBase()  Line 818 + 0x31	C++
Torque_DEBUG.exe!Player::~Player()  Line 841 + 0x53	C++
Torque_DEBUG.exe!Player::'scalar deleting destructor'()  + 0x2b	C++
Torque_DEBUG.exe!SimGroup::~SimGroup()  Line 1421 + 0x3d	C++
Torque_DEBUG.exe!SimGroup::'scalar deleting destructor'()  + 0x2b	C++
Torque_DEBUG.exe!SimObject::deleteObject()  Line 398 + 0x33	C++
Torque_DEBUG.exe!cSimObjectdelete(SimObject * object=0x067a5570, int argc=2, const char * * argv=0x00d7fff8)  Line 639	C++
Torque_DEBUG.exe!cSimObjectdeletecaster(SimObject * object=0x067a5570, int argc=2, const char * * argv=0x00d7fff8)  Line 635 + 0x62	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=599, const char * functionName=0x01b5b36c, Namespace * thisNamespace=0x014059e4, unsigned int argc=0, const char * * argv=0x00d7fff8, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1179 + 0x20	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=13347, const char * functionName=0x01af93ac, Namespace * thisNamespace=0x014059e4, unsigned int argc=1, const char * * argv=0x00d7fff8, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1112	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=945, const char * functionName=0x013ef1e8, Namespace * thisNamespace=0x01b719e4, unsigned int argc=1, const char * * argv=0x00d7fff8, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1112	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=8, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1112	C++
Torque_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * string=0x013b4938, bool noCalls=false, int setFrame=0)  Line 568	C++
Torque_DEBUG.exe!Con::evaluate(const char * string=0x013b4938, bool echo=false, const char * fileName=0x00000000)  Line 786	C++
Torque_DEBUG.exe!ceval(SimObject * __formal=0x00000000, int argc=2, const char * * argv=0x00d7fff8)  Line 1029 + 0x10	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=31, const char * functionName=0x01b80708, Namespace * thisNamespace=0x014059e4, unsigned int argc=2, const char * * argv=0x00d7fff8, bool noCalls=false, const char * packageName=0x00000000, int setFrame=-1)  Line 1129 + 0x20	C++
Torque_DEBUG.exe!CodeBlock::exec(unsigned int ip=15, const char * functionName=0x00000000, Namespace * thisNamespace=0x00000000, unsigned int argc=0, const char * * argv=0x00000000, bool noCalls=false, const char * packageName=0x00000000, int setFrame=0)  Line 1112	C++
Torque_DEBUG.exe!CodeBlock::compileExec(const char * fileName=0x00000000, const char * string=0x01b7fa00, bool noCalls=false, int setFrame=0)  Line 568	C++
Torque_DEBUG.exe!Con::evaluate(const char * string=0x01b7fa00, bool echo=false, const char * fileName=0x00000000)  Line 786	C++
Torque_DEBUG.exe!GuiControl::onAction()  Line 1184 + 0x13	C++
Torque_DEBUG.exe!GuiButtonBaseCtrl::onAction()  Line 275	C++
Torque_DEBUG.exe!GuiButtonBaseCtrl::onMouseUp(const GuiEvent & __formal={...})  Line 190 + 0x10	C++
Torque_DEBUG.exe!GuiCanvas::rootMouseUp(const GuiEvent & event={...})  Line 644 + 0x2e	C++
Torque_DEBUG.exe!GuiCanvas::processInputEvent(const InputEvent * event=0x0696e498)  Line 541	C++
Torque_DEBUG.exe!DemoGame::processInputEvent(InputEvent * event=0x0696e498)  Line 810 + 0x18	C++
Torque_DEBUG.exe!GameInterface::processEvent(Event * event=0x0696e498)  Line 72 + 0x11	C++
Torque_DEBUG.exe!GameInterface::processEvents()  Line 191 + 0x22	C++
Torque_DEBUG.exe!DemoGame::main(int argc=1, const char * * argv=0x013843c0)  Line 684 + 0x12	C++
Torque_DEBUG.exe!run(int argc=1, const char * * argv=0x013843c0)  Line 1260 + 0x1a	C++
Torque_DEBUG.exe!WinMain(HINSTANCE__ * hInstance=0x00400000, HINSTANCE__ * __formal=0x00000000, char * lpszCmdLine=0x00141f4a, HINSTANCE__ * __formal=0x00000000)  Line 1347 + 0x17	C++
Torque_DEBUG.exe!WinMainCRTStartup()  Line 251 + 0x1d	C
kernel32.dll!7c816fd7()

cont'd...
#2
10/26/2006 (5:07 am)
...cont'd

What's most bizarre is how specific this bug is. The bug only occurs on Windows when a ShapeBase object is being deleted via the MissionCleanup group when TORQUE_DISABLE_MEMORY_MANAGER is defined. I have tried running the same code with TORQUE_DISABLE_MEMORY_MANAGER defined on my Mac and things work fine. I have also tried running the same code on Windows with TORQUE_DISABLE_MEMORY_MANAGER not defined and things work fine. Lastly, deleting all the ShapeBases manually while in the mission (either through the mission editor or through the console) works fine as well... its just when those ShapeBases are deleted at the end of the mission via MissionCleanup that it crashes.

Would anyone have any ideas as to why this is happening? I know that I can just keep TORQUE_DISABLE_MEMORY_MANAGER undefined, but I am very curious as to why this doesn't work... and a little worried.

If any has any information that might help, it would be greatly appreciated!

Thanks,

Stephane