[ wxwindows-Bugs-1724495 ] memory leak in wxTopLevelWindowMSW
SourceForge.net
noreply at sourceforge.net
Tue Feb 26 06:28:06 PST 2008
Bugs item #1724495, was opened at 2007-05-23 21:23
Message generated for change (Comment added) made by juliansmart
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1724495&group_id=9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: WinCE specific
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Private: No
Submitted By: stas (stishkin)
Assigned to: Julian Smart (juliansmart)
Summary: memory leak in wxTopLevelWindowMSW
Initial Comment:
I have noticed memory leak in my program, then
I ran minimal, and I've got the same memory leak.
when creating a frame or a dialog
function
void wxTopLevelWindowMSW::Init() in file toplevel.cpp
gets called at least 2 times, thus
(this code is from line 149 to line 155)
#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
SHACTIVATEINFO* info = new SHACTIVATEINFO;
wxZeroMemory(*info);
info->cbSize = sizeof(SHACTIVATEINFO);
m_activateInfo = (void*) info;
#endif
allocates SHACTIVATEINFO two times, meanwhile
it is destroyed only once in destructor of
wxTopLevelWindowMSW.
The easy fix is to make sure that if m_activateInfo is
not NULL, then delete it, and assigned it to NULL.
I could not find anywhere that Init must be called only
once for every creation of toplevel window.
Therefore I'd like
to make sure that in wxWidgets Init might be called several times when toplevel window is created.
Stas.
----------------------------------------------------------------------
>Comment By: Julian Smart (juliansmart)
Date: 2008-02-26 14:28
Message:
Logged In: YES
user_id=59495
Originator: NO
Thanks, fixed by removing the redundant Init() call in Create().
----------------------------------------------------------------------
Comment By: stas (stishkin)
Date: 2007-05-24 18:10
Message:
Logged In: YES
user_id=1695754
Originator: YES
Yes I know that there is only "new" operator there,
but "Init" gets called at least twice, that's why there is a 12 byte
memory leak.
If you place a break point at line 150 in void wxTopLevelWindowMSW::Init()
in toplevel.cpp and one in destructor of wxTopLevelWindowMSW, this is where
clean up for m_activateInfo; and run, say, Minimal, you'll see that you'll
get 2 hits at the brakepoint in "Init", meanwhile it will break only once
in destructor when you exit minimal. So we get a memory leak.
Stas.
----------------------------------------------------------------------
Comment By: ONEEYEMAN (oneeyeman)
Date: 2007-05-24 18:01
Message:
Logged In: YES
user_id=1325635
Originator: NO
Stas,
There is only one "new" operator here.
Second allocation is done somewhere else.
Thank you.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1724495&group_id=9863
More information about the wx-dev
mailing list