Game Development Community

Hang on exit

by Adam Beaumont · in Torque Game Engine · 11/26/2003 (5:06 am) · 0 replies

I've recently started getting a problem with exiting torque after running my mod. On exit, sometimes, the app hangs. If I pause in visual studio I find that the code is stuck in platformmemory.cc, treeInsert.

Looking further up the call stack it seems to be doing:

Con::shutdown()
-Namespace::shutdown()
--Namespace::clearEntries()
---Namespace::entry::Clear()
----Codeblock::decRefCount()
-----Codeblock::'scalar deleting destructor*(unsigned int)
------Operator::delete(void *)
-------Memory::free(void*, unsigned char)
--------Memory::treeinsert(Memory::FreeHeader *)

As far as I can tell its getting stuck in treeinsert in the following while loop

while(hdr != gFreeTreeRoot && (hdr->parent->color == Red))
{
      TreeNode *parent = hdr->parent;
      TreeNode *pparent = hdr->parent->parent;
...}

parent and pparent are the same address in memory so its just looping round for ever...

My guess is that I've added something that isn't clearing itself like it should and thats causing the problem but tbh I have no idea. Is there any way to get a better indication of where exactly the problem might be from within the debug environment ?

Any help would be greatly appreciated!

Adam