How do I properly dispose of a wxgrid that uses a custom wxPyGridTableBase?
The demo application shows a leak.
One example from a real world environment:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
hp 7253 0.0 3.9 24336 20368 pts/14 S Dec06 1:39 python -O main.py
hp 18462 1.8 2.2 15900 11700 pts/14 S 18:29 0:02 python -O main.py
This app consists of 4 grids, the latter process shows the memory footprint
when it's started, the former after moving and switching between the grids
a few dozen times. Yes, this one's running since 3 days. As a result of this
long term examination, I can state: moving in and switching between grids
consumes memory, but luckily the idle handler doesn't leak
Seriously, I think, it's not a dispose problem - the leak is in the grid
display methods. Would be nice to know, if this happens also, when a grid
consists from only custom rendered grids, but I'm currently too busy to
dig deaper into this problem.
My application loads up to 1200 records into the grid each time a tab
control changes. This leads to fairly large leak. I'm using MS windows, but
it sounds like this behavior occurs under other operating systems as well.
Does anyone have any suggestions? This is actually a show-stopper for me. I
am considering using PythonWin instead of wxWindows because of this. I'd
hate to do that. I would really like my application to be as cross-platform
capable as possible. Thanks for any input.
···
----- Original Message -----
From: "Hans-Peter Jansen" <hpj.lisa@t-online.de>
To: <wxpython-users@lists.sourceforge.net>
Sent: Saturday, December 09, 2000 1:01 PM
Subject: Re: [wxPython] wxgrid memory leak
python@dunsinane.net wrote:
>
> How do I properly dispose of a wxgrid that uses a custom
wxPyGridTableBase?
> The demo application shows a leak.
One example from a real world environment:
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
hp 7253 0.0 3.9 24336 20368 pts/14 S Dec06 1:39 python -O
main.py
hp 18462 1.8 2.2 15900 11700 pts/14 S 18:29 0:02 python -O
main.py
This app consists of 4 grids, the latter process shows the memory
footprint
when it's started, the former after moving and switching between the grids
a few dozen times. Yes, this one's running since 3 days. As a result of
this
long term examination, I can state: moving in and switching between grids
consumes memory, but luckily the idle handler doesn't leak
Seriously, I think, it's not a dispose problem - the leak is in the grid
display methods. Would be nice to know, if this happens also, when a grid
consists from only custom rendered grids, but I'm currently too busy to
dig deaper into this problem.
simple dilemna: I'm trying to figure out how to clear the text in several
textctrl fields. I'm calling it as textfield.Clear() which doesn't seem to
be causing any bugs with the program, but I'm always left with the 'default'
text - which is precisely the text I wish to clear. is this the normal
behavior (to clear to 'default text')??
I have a Main Class that creates an instance of an Input Class.
within the __init__ of the Input Class, I've created a notebook to which are
appended several pages (instances of other classes).
Furthermore, I have another method (clearFields()) within the Input Class in
which I have code for clearing the fields of the notebook pages...
Problem is, when I create an instance of the Input Class from the Main Class
and then try to apply the Input Class's method of ClearFields, it doesn't
work. But if I just try to clear the fields directly from the __init__ of
the Input Class, no problem..
pseduocode:
class Main:
def Add():
inputDlg = Input(parent, etc...)
inputDlg.clearFields()
class Input:
def __init__:
# create notebook
# create instances of page classes and append them to notebook
def clearFields():
self.page1.field1.Clear()
what I want to do should be simple enough, but I'm having a heck of a time
figuring out how.
Basically, I have two classes. One of which is essentially a display class,
and the other is an input class.
Now, I also have some global variables defined (namely, a dictionary and a
list).
What I would like to do is to
1. obtain new data from the input class and append it to the dictionary (so
far so good)
2. update the display class (it's split into two panels- one of which is a
listbox (for displaying the contents of the global list, and the other is a
window with child windows (for displaying the contents of the dictionary...)
Surely there must be a simple way to either refresh the entire window so
that it shows the updated values, or reset the values of the individual
fields.
> How do I properly dispose of a wxgrid that uses a custom
wxPyGridTableBase?
> The demo application shows a leak.
It certainly does, and quite badly... I'll see if I can track it down.
I've just checked in to CVS a bunch of changes that should take care of
this. I made a couple bad assumptions early on about when I was and wasn't
getting a new reference from the Python API, and the code ended up getting
copied and tweaked all over the place. It showed up so drasticly in the
grid demo because of the huge number of callbacks (not events) that it does
to fetch values from the table, but there was actually little similar
problems all over. Should all be gone now though.
I'll try and make an interim binary for win32 later today.
Please reproduce the problem in a small complete sample and send it.
Code has changed drastically over the past few days - I ended up doing a
work-around. It would probably take me a fair amount of time to reproduce
the problem, but if I stumble across this problem again (I probably will)
I'll be sure to post the code here. thanks.