Handle leak?

"Eric Thiebaut" <[email protected]> Mon, 20 Jun 2005 22:11:08 +1000
Newsgroups gmane.comp.lib.wxwindows.wxnet
Message-ID <[email protected]>
Hi,

It looks like wx.net 6.1 leaks all GDI handles corresponding to
GDIObject
allocated by the C# code.
For example:
new wx.Bitmap(_org.X+_size.Width,_org.Y+_size.Height)
Will leak 1 GDI handle, no matter if I try to call Dispose()...

I've tried to trak it down and it looks like it could be because
memOwn is never set to true, and therefore the handle is never closed.
Is this expected (and is there a way to close the handles manually)
or is this a leak?
To reproduce it on Windows, you can open the task manager, select to
display
the "GDI objects" column, and run for example the Font sample (other
samples
like for ex dnd also present the same behaviour).
Then, if you force a refresh (either minimize/maximise, ALT/TAB + Back
or
resize the window) you'll see that 1 handle is leaked each time.
If you resize the window, you'll see that the handle could very quickly
goes to 1000+. My sample application leaks a good few handles at each
repaint,
and windows stops repainting it after just a few seconds of resizing.

Looking at how memOwn is used in the code, it looks like some classes
(like wxDateTime) seem to set it properly, but that none of the GDI
classes
(I've tried Pen, Font, Bitmap & various DCs) set it properly.

Eric


-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click