[wx-dev] [ wxwindows-Bugs-1905138 ] wxMac 2.8.7 : wxListCtrl memory leak

SourceForge.net noreply at sourceforge.net
Sat May 3 23:42:52 PDT 2008


Bugs item #1905138, was opened at 2008-03-01 16:31
Message generated for change (Comment added) made by daviddc
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1905138&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: wxMac specific
Group: Platform specific
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Brucey (woollybah)
Assigned to: Nobody/Anonymous (nobody)
Summary: wxMac 2.8.7 : wxListCtrl memory leak

Initial Comment:
Removing items from a wxListCtrl doesn't appear to free the item objects associated with it.

Although the list contents itself is cleared, the wxMacDataItem objects are never freed.

I added some debug to the wxMacDataItem destructor (max/carbon/utils.cpp), cleared and re-populated the list a few times, and the destructor was never called.

Please fix!

----------------------------------------------------------------------

Comment By: David De Candia (daviddc)
Date: 2008-05-04 16:42

Message:
Logged In: YES 
user_id=2078702
Originator: NO

>could you please provide us with a small diff to the listctrl sample

You can find a sample demonstrating the problem here
http://wxforum.shadonet.com/viewtopic.php?t=19224

----------------------------------------------------------------------

Comment By: Brucey (woollybah)
Date: 2008-03-01 23:20

Message:
Logged In: YES 
user_id=518148
Originator: YES

You can pretty much watch the memory increasing by tapping F2 in the
listctrl sample (each hit which re-creates the wxListCtrl and data in
report mode).

If you run the app through ObjectAlloc you'll find that each list item is
created ok, but is never freed.

Example of list item object life-cycle :

#	Category	Event Type	Timestamp	Address	Size	Responsible
Library	Responsible Caller
0	GeneralBlock-48	Malloc	00:25.428	0x17fa3bc0	48	leaktest.debug	wxMacDataBrowserListCtrlControl::CreateItem()


And an exampe of what one might expect to see of an object life-cycle
(create/delete) :

#	Category	Event Type	Timestamp	Address	Size	Responsible
Library	Responsible Caller
44	GeneralBlock-48	Malloc	00:30.106	0x181cf4b0	48	leaktest.debug	wxWindow::MacInstallEventHandler(wxOpaqueControlRef*)
45	GeneralBlock-48	Free	00:30.289	0x181cf4b0	-48	leaktest.debug	wxWindow::~wxWindow()

RemoveDataBrowserItems() doesn't appear to be freeing anything, just
removing them from the list.

Sorry about the lack of a separate C++ example, but it's not my primary
language. However the F2 list refresh as mentioned above demonstrates the
problem clearly.

thanks, 
Brucey.

----------------------------------------------------------------------

Comment By: Stefan Csomor (csomor)
Date: 2008-03-01 17:47

Message:
Logged In: YES 
user_id=81467
Originator: NO

Hi

could you please provide us with a small diff to the listctrl sample or
some other sample, that can serve as a test case for this bug ?

Thanks,

Stefan

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1905138&group_id=9863


More information about the wx-dev mailing list