[wxPython-users] Memory Leak on wxMSW with wx.StaticBitmap.SetBitmap() ?

Robin Dunn robin at alldunn.com
Thu Jun 1 10:28:10 PDT 2006


Darryl Ross wrote:
> Hey All,
> 
> Attached is a small sample program that hopefully demonstrates the
> problem I'm having (it does on my system!)
> 
> In my application I have a number of small icons that show the status of
> various things. I do a SetBitmap() on them to update them. I've found
> that over time the memory utilisation in my application keeps growing
> without bounds. The sample program just uses a wx.Timer to simulate what
> happens to speed up the timeframe.

I've backported a change that was done for 2.7 to fix this problem.  I 
won't be able to check in the change because it breaks binary 
compatibility, but we don't care about that as much for wxPython so I'll 
be able to include that in the next release.

> 
> In my sample app, I'm positioning the image at (10,10) and another image
> appears in the top-left corner. I'm guessing a new image is being
> created every time the timer fires (and being placed at the default
> position of (0,0).

Actually, the second image you see is just an artifact of the frame 
resizing its only child to fill the space, so the static bitmap is being 
see first at the position you specify, then it's getting repositioned 
and resized (although the image itself stays the same size) and redrawn.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list