Memory leak in wxHashTableBase2::AllocTable

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
zobbo
Experienced Solver
Experienced Solver
Posts: 58
Joined: Sat Aug 18, 2007 4:41 am

Memory leak in wxHashTableBase2::AllocTable

Post by zobbo »

Hi,

I've found a memory leak in my application and traced it back to wxWidgets framework. Even when none of my code is running I get this leak every time. I had to convert the VC++ solution to VS2012. I corrected the target names (which the conversion broke) and set it to statically link multi-threaded debug, as is my project that imports wxwidgets. The leak breaks at the first return here in hashmap.h when I set a breakpoint at IMPLEMENT_APP_CONSOLE(MyApplication)

Code: Select all

static void** AllocTable( size_t sz )
    {
        return (void **)calloc(sz, sizeof(void*));
    }
    static void FreeTable(void *table)
    {
        free(table);
    }
};
I discovered that a second leak comes from xti.cpp:

Code: Select all

void wxTypeInfo::Register()
{
    if ( ms_typeTable == NULL )
        ms_typeTable = new wxTypeInfoMap();

    if( !m_name.empty() )
        (*ms_typeTable)[m_name] = this;
}
The first allocation here causes the second leak.

I had set wxUSE_EXTENDED_RTTI 1 and rebuilt the libraries. When I set this back to 0 the memory leak disappears. Just thought I better mention it.

This is on wxWidgets 2.9.4 Debug build.

Cheers,
Zobbo
Zobbo

Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium
User avatar
doublemax
Moderator
Moderator
Posts: 19158
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: Memory leak in wxHashTableBase2::AllocTable

Post by doublemax »

Please test again with version 3.0.0-rc2
http://biolpc22.york.ac.uk/pub/3.0.0-rc2/

If it still happens there, please open a bug report here:
http://trac.wxwidgets.org/
Use the source, Luke!
zobbo
Experienced Solver
Experienced Solver
Posts: 58
Joined: Sat Aug 18, 2007 4:41 am

Re: Memory leak in wxHashTableBase2::AllocTable

Post by zobbo »

doublemax wrote:Please test again with version 3.0.0-rc2
http://biolpc22.york.ac.uk/pub/3.0.0-rc2/

If it still happens there, please open a bug report here:
http://trac.wxwidgets.org/
Ok, thanks I will do when I get a chance and I'll get back to you.

Cheers,
Zobbo
Zobbo

Wxwidgets 2.9.0, Visual C++ Express 2005, Windows Vista x64 Home Premium
Post Reply