yes, a GTK app from the python shell. And not using the toolbar. I'll see if I can extract out a sample of code that demonstrates the problem I'm having.
Thx Mathew On Thu, Nov 19, 2009 at 10:56 AM, John Hunter <[email protected]> wrote: > > > > > On Nov 19, 2009, at 12:53 PM, Mathew Yeates <[email protected]> wrote: > > I am running my gtk app from python. I am deleting the canvas and running > gc.collect(). I still seem to have a reference to my memmapped data. > > Any other hints? > > > Gtk app from the standard python shell? > > Are you using the mpl toolbar? It keeps a ref to the canvas. If you can > create a small freestanding example, that would help > > > > > -Mathew > > On Thu, Nov 19, 2009 at 10:42 AM, John Hunter < <[email protected]> > [email protected]> wrote: > >> >> >> >> >> On Nov 19, 2009, at 12:35 PM, Mathew Yeates < <[email protected]> >> [email protected]> wrote: >> >> Yeah, I tried that. >> >> Here's what I'm doing. I have an application which displays different >> dataset which a user selects from a drop down list. I want to overwrite the >> existing plot with a new one. I've tried deleting just about everything get >> matplotlib to let go of my data! >> >> >> >> What is everything? Are you using pyplot or are you embedding mpl in a >> GUI? If the latter, are you deleting the FigureCanvas? You will also need >> to call gc.collect after deleting the mpl objects because we use a lot of >> circular references. Pyplot close does this automatically, but this does not >> apply to embedding. >> >> How are you running you app? From the shell or IPython? >> >> >> >> >> Mathew >> >> On Thu, Nov 19, 2009 at 10:30 AM, John Hunter < >> <[email protected]><[email protected]> >> [email protected]> wrote: >> >>> >>> >>> >>> >>> On Nov 19, 2009, at 11:57 AM, Robert Kern < >>> <[email protected]><[email protected]> >>> [email protected]> wrote: >>> >>> > On Thu, Nov 19, 2009 at 11:52, Mathew Yeates < >>> > <[email protected]><[email protected]> >>> [email protected]> >>> > wrote: >>> >> There is definitely something wrong with matplotlib/numpy. Consider >>> >> the >>> >> following >>> >>> from numpy import * >>> >>> mydata=memmap('map.dat',dtype=float64,mode='w+',shape=56566500) >>> >>> del mydata >>> >> >>> >> I can now remove the file map.dat with (from the command line) $rm >>> >> map.dat >>> >> >>> >> However >>> >> If I plot mydata before the line >>> >>> del mydata >>> >> >>> >> >>> >> I can't get rid of the file until I exit python!! >>> >> Does matplotlib keep a reference to the data? >>> > >>> > Almost certainly. >>> > >>> >> How can I remove this >>> >> reference? >>> > >>> > Probably by deleting the plot objects that were created and close all >>> > matplotlib windows referencing the data. If you are using IPython, you >>> > should know that many of the returned objects are kept in Out, so you >>> > will need to clear that. There might be some more places internal to >>> > matplotlib, I don't know. >>> > >>> >>> Closing the figure window containg the data *should* be enough. In >>> pylab/pyplot, this also triggers a call to gc.collect. >>> >>> >>> >>> >>> > With some care, you can use gc.get_referrers() to find the objects >>> > that are holding direct references to your memmap. >>> > >>> > -- >>> > Robert Kern >>> > >>> > "I have come to believe that the whole world is an enigma, a harmless >>> > enigma that is made terrible by our own mad attempt to interpret it as >>> > though it had an underlying truth." >>> > -- Umberto Eco >>> > _______________________________________________ >>> > NumPy-Discussion mailing list >>> > <[email protected]> <[email protected]> >>> [email protected] >>> > <http://mail.scipy.org/mailman/listinfo/numpy-discussion><http://mail.scipy.org/mailman/listinfo/numpy-discussion> >>> http://mail.scipy.org/mailman/listinfo/numpy-discussion >>> _______________________________________________ >>> NumPy-Discussion mailing list >>> <[email protected]> <[email protected]> >>> [email protected] >>> >>> <http://mail.scipy.org/mailman/listinfo/numpy-discussion><http://mail.scipy.org/mailman/listinfo/numpy-discussion> >>> http://mail.scipy.org/mailman/listinfo/numpy-discussion >>> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> <[email protected]>[email protected] >> <http://mail.scipy.org/mailman/listinfo/numpy-discussion> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> >> >> _______________________________________________ >> NumPy-Discussion mailing list >> <[email protected]>[email protected] >> <http://mail.scipy.org/mailman/listinfo/numpy-discussion> >> http://mail.scipy.org/mailman/listinfo/numpy-discussion >> >> > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > > > _______________________________________________ > NumPy-Discussion mailing list > [email protected] > http://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list [email protected] http://mail.scipy.org/mailman/listinfo/numpy-discussion
