I'm experimenting with the DirBrowserButton, (it's really cool!) but
wxPython is reporting a memory leak when I close the application.
The report looks like this.
pythonw -u MinimalGrid.py
11:03:39: There were memory leaks.
11:03:39: ----- Memory dump -----
11:03:39: wxColour at $1D7D068, size 16
11:03:39: wxDirDialog at $1D7F4B8, size 288
11:03:39:
11:03:39:
11:03:39: ----- Memory statistics -----
11:03:39: 1 objects of class wxDirDialog, total size 288
11:03:39: 1 objects of class wxColour, total size 16
11:03:39:
11:03:39: Number of object items: 2
11:03:39: Number of non-object items: 0
11:03:39: Total allocated size: 304
11:03:39:
11:03:39:
Is there anything special I need to do to clean up after using these things?
I've been get similar leaks in my application with wxMask, wxBitmap and
wxFont. I've tried explicitly deleting them, but nothing seems to help. I'm
guessing that either something is holding a reference to them or that these
are bogus messages.
···
On Friday 03 August 2001 10:03, you wrote:
> I'm experimenting with the DirBrowserButton, (it's really cool!) but
> wxPython is reporting a memory leak when I close the application.
>
> The report looks like this.
>
> >pythonw -u MinimalGrid.py
>
> 11:03:39: There were memory leaks.
> 11:03:39: ----- Memory dump -----
> 11:03:39: wxColour at $1D7D068, size 16
> 11:03:39: wxDirDialog at $1D7F4B8, size 288
> 11:03:39:
>
> Is there anything special I need to do to clean up after using these
things?
Not sure where the wxColour is coming from, but you always need to call the
Destroy() method of dialogs when you are done with them.
I've been get similar leaks in my application with wxMask, wxBitmap and
wxFont. I've tried explicitly deleting them, but nothing seems to help.
I'm
guessing that either something is holding a reference to them or that
these
are bogus messages.
If you have globals that are or hold references to the objects that appear
to be leaking then you can get bogus messages sometimes because of the order
that things are cleaned up. The memory check is triggered when the wx
module is cleaned up by Python so anything still left in other modules will
appear in the list.
Another common culprit is default parameter values, for example:
def foo(font = wxFont(...)):
whatever()
···
--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters? http://wxPython.org Relax with wxPython!