[wx 2.6.3, X11, g++ 4.0.3] Memory leaks present using wxEntry

Lukasz Kosewski lkosewsk at gmail.com
Tue Oct 17 14:44:26 PDT 2006


Hello all,

I've attached an incredibly simple app I've written for WxWidgets
2.6.3 running on X11 (no GTK, Motif, etc.).

You'll note it's a very stripped down version of the hworld test
program on the main webpage; I've ripped out pretty much everything
but the main wxFrame, and changed the main() method of the program so
that it repeatedly calls wxEntry(...) in a loop:

int main(int argc, char **argv)
{
	int ret;
	while (1)
		ret =3D wxEntry(argc, argv);
	return ret;
}

I'm running WxX11 2.6.3 with patch2
(ftp://biolpc22.york.ac.uk/pub/2.6.3/wxWidgets-2.6.3-Patch-2.tar.gz)
and a patch which fixes wxEntry segfaulting if called more than once
while the libraries are loaded
(http://comments.gmane.org/gmane.lisp.wxcl.devel/383).

I compile my application and run it, after it spawns, I 'top -p' its
process number so I can have a look at its resident memory footprint,
and then repeatedly close the main frame, causing the main loop to run
wxEntry again.

I notice that every time that the loop re-initializes, the application
leaks ~24k of memory.  I've confirmed that all destructors are being
called properly, so there is no leak from the application end.

Valgrind identifies most of the leaks as mallocs or callocs in
XOpenDisplay, _Xenq, etc. so I figure that at the end of wxEntry,
something X-related is not being de-allocated properly.

If someone could give me any input on whether or not I'm missing an
API call somewhere, or if a different version of WxWidgets or a patch
fixes these issues, I'd be most grateful.  I've attempted to compile
WxX11 2.7.1, but there were compile errors with missing headers, so I
haven't had a chance to run it.

I'm more than willing to try any suggestions any of you might have -
please see the attached program for more information.

Thanks in advance,

Luke Kosewski
-------------- next part --------------
A non-text attachment was scrubbed...
Name: hworld.cc
Type: text/x-c++src
Size: 566 bytes
Desc: not available
Url : http://lists.wxwidgets.org/pipermail/wx-users/attachments/20061017/04=
47d60a/hworld.cc


More information about the wx-users mailing list