It's not off topic -- and I understand what you're trying to do much 
better now.

I assume at some point you convert all of the xml into a Numpy array and 
pass that to matplotlib?  matplotlib will only keep a reference to the 
Numpy array, which should be far more compact, and you can safely remove 
the references to the xml tree and that memory should be freed.

Cheers,
Mike

guillaume ranquet wrote:
> sorry If my last message was confusing.
> I'm exctracting data from an xml file (100megs of xml) which is stored
> by my app as an array of dict in which I pick only some keys to plot.
> I'm just trying to figure out if the gc is able to free some parts of
> the dict (the un-plotted parts) by itself (and it seems not) or If I
> have to give more hints to the gc.
> my gig of ram is getting used, and I'd like to increase the set of data
> a bit.
>
> I can make a hardcopy of my datas, pass this copy to matplotlib and del
> everything (so that it *should* be clean, from my understandings).
>
> actually, my design is quite horrible. prolly a rewrite from scratch is
> the best thing to do.
>
> anyway, it's a bit off-topic on the matplotlib user list :)
>
> Michael Droettboom wrote:
>   
>> I don't follow...  If you need to free the data, you have to ensure that
>> matplotlib doesn't need it, and the only way to do that is destroy the
>> figure that references it.  It's virtually impossible to create a
>> dangling reference in Python (from within Python).
>>
>> Mike
>>
>> guillaume ranquet wrote:
>>     
>>> Thanks Mike,
>>> I just wanted to be sure wether matplotlib had a copy or not.
>>> I'll have to work on giving hints to the GC then...
>>>
>>> guillaume.
>>>
>>> Michael Droettboom wrote:
>>>  
>>>       
>>>> Yes, Python is reference counted (with a garbage collector to handle
>>>> cycles etc.).  So, yes, the matplotlib plot keeps a "reference" to your
>>>> data after you pass it in so it continue to redraw it as the plot is
>>>> panned/zoomed/resized etc.  You can safely del your local reference, but
>>>> the memory itself will not be freed, since matplotlib still needs it.
>>>>
>>>> Mike
>>>>
>>>> guillaume ranquet wrote:
>>>>    
>>>>         
>>>>> I'm currently trying to improve my app to render more and more data.
>>>>> I'm wondering if matplotlib keeps an internal copy of the datas once
>>>>> the
>>>>> plot function has been called?
>>>>>
>>>>> from what I understand from python (I'm quite new to python),
>>>>> everything
>>>>>  is reference and no implicit copies are done. I'm trying to check on
>>>>> matplotlib if it's the case but I must admit I got some difficulties xD
>>>>>
>>>>>
>>>>> to sum it up: can I del the arrays I just passed to an axis.plot ?
>>>>>
>>>>>
>>>>> thanks for your help :)
>>>>> ----
>>>>> This message contains confidential information and may contain
>>>>> information that is legally privileged.  If you have received this
>>>>> message by mistake, please immediately notify us and delete the
>>>>> original message. Thank you. Ce message contient des informations
>>>>> confidentielles.  S'il vous est
>>>>> parvenu par erreur, merci de bien vouloir nous en aviser par retour,
>>>>> de n'en faire aucun usage et de n'en garder aucune copie.
>>>>> ----
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>>
>>>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>>>>> is a gathering of tech-side developers & brand creativity
>>>>> professionals. Meet
>>>>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>>>>> iPhoneDevCamp as they present alongside digital heavyweights like
>>>>> Barbarian Group, R/GA, & Big Spaceship.
>>>>> http://p.sf.net/sfu/creativitycat-com
>>>>> _______________________________________________
>>>>> Matplotlib-users mailing list
>>>>> Matplotlib-users@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>>>         
>>>>>           
>>> ----
>>> This message contains confidential information and may contain
>>> information that is legally privileged.  If you have received this
>>> message by mistake, please immediately notify us and delete the
>>> original message. Thank you. 
>>> Ce message contient des informations confidentielles.  S'il vous est
>>> parvenu par erreur, merci de bien vouloir nous en aviser par retour,
>>> de n'en faire aucun usage et de n'en garder aucune copie.
>>> ----
>>>
>>> ------------------------------------------------------------------------------
>>>
>>> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
>>> is a gathering of tech-side developers & brand creativity
>>> professionals. Meet
>>> the minds behind Google Creative Lab, Visual Complexity, Processing, &
>>> iPhoneDevCamp as they present alongside digital heavyweights like
>>> Barbarian Group, R/GA, & Big Spaceship.
>>> http://p.sf.net/sfu/creativitycat-com
>>> _______________________________________________
>>> Matplotlib-users mailing list
>>> Matplotlib-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>>>   
>>>       
>
> ----
> This message contains confidential information and may contain information 
> that is legally privileged.  If you have received this message by mistake, 
> please immediately notify us and delete the original message. Thank you.  
>
> Ce message contient des informations confidentielles.  S'il vous est parvenu 
> par erreur, merci de bien vouloir nous en aviser par retour, de n'en faire 
> aucun usage et de n'en garder aucune copie.
> ----
>
> ------------------------------------------------------------------------------
> Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
> is a gathering of tech-side developers & brand creativity professionals. Meet
> the minds behind Google Creative Lab, Visual Complexity, Processing, & 
> iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
> Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users
>   

-- 
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA


------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to