memory tracking and dtool_config.h

Hey guys. So I have Panda3D building with optimize=1 via makepanda and running in Visual Studio 2005’s debugger with symbols. I can even set breakpoints and have Intellisense working via a dummy project file and I’d say things are starting to look good. At least when I’m running pview.

But now I’m trying to use Panda3D as a C++ library. Again everything seems fine, until I call this innocent looking function:

PandaFramework::set_window_title(const string &title)

And it dies in the most spectacular way. It would appear Panda3D overrides the c++ global operator new “void* operator new( std::size_t size )” and from there accesses a std::map of reference counted free lists which have some kind of pointer tracking… Or something, I’m starting to wonder if my callstack is ok.

Anyway. This sound familiar to anyone?

Otherwise I’m wondering how to control the settings in dtool_config.h. I’d like to enable USE_MEMORY_NOWRAPPERS and disable DO_MEMORY_USAGE while still building in debug. If I edit the file it is immediately regenerated.

Sounds familiar. Read this thread:

To edit the config options, you’ll need to edit, and see how it generates them. Just find the DTOOL_CONFIG variable and change the appropriate flags from UNDEF to 1.

So I spent considerable time trying different configurations and ripping out parts of panad3d’s memory management trying to chase this down but I never found the source of what looks like visual studio/debug/win32 memory corruption showing up in their free list tracking. I had simple examples working, but it would inevitably snarl up. Unfortunately for me that was a show stopper for a serious development platform.

So you say your MSVC++ debug session has problems with the panda3d’s reference counting memory management? And you want to disable it? I think panda3d relies on its memory management.

Naww. The memory tracking in Panda is strictly for debugging purposes, for tracking memory utilization via pstats, or for tracking down memory leaks via the MemoryUsage class. You can turn it off completely without difficulty, and it’s not even difficult.

In ppremake, define:


and all of this stuff gets compiled out, in favor of the standard new and delete operators. I don’t know if it’s possible to do this using makepanda, though.