Seems I forgot to add the word "opensource" and "free" to it. :lol:
When my copy of Code::Blocks is running in debug mode in Visual Studio, it dumps a list of all non-freed objects at exit including size of the allocation and the filename and line number where they were allocated. :shock: Some feature of wxWidgets that came out in the VS debugger??
Seems you have noticed it.
The redefinition of operator
new (which thomas likes to ditch very often
) haves a real and
very useful purpose.
And it's only enabled when you are in debug build. But anyways, you can disable it by settings wxUSE_DEBUG_NEW_ALWAYS to 0 in setup.h.
For wxDebugContext to do its work, the new and delete operators for wxObject have been redefined to store extra information about dynamically allocated objects (but not statically declared objects). This slows down a debugging version of an application, but can find difficult-to-detect memory leaks (objects are not deallocated), overwrites (writing past the end of your object) and underwrites (writing to memory in front of the object).
Here's something very useful about the class wxDebugContext:
wxDebugContext is a class for performing various debugging and memory tracing operations.
This class has only static data and function members, and there should be no instances. Probably the most useful members are SetFile (for directing output to a file, instead of the default standard error or debugger output); Dump (for dumping the dynamically allocated objects) and PrintStatistics (for dumping information about allocation of objects). You can also call Check to check memory blocks for integrity.
Here's an example of use. The SetCheckpoint ensures that only the allocations done after the checkpoint will be dumped.
wxDebugContext::SetCheckpoint();
wxDebugContext::SetFile("c:\\temp\\debug.log");
wxString *thing = new wxString;
char *ordinaryNonObject = new char[1000];
wxDebugContext::Dump();
wxDebugContext::PrintStatistics();