[Scipy-tickets] [SciPy] #1501: import in member function causes object to persist

SciPy Trac scipy-tickets@scipy....
Wed Aug 24 08:22:17 CDT 2011

#1501: import in member function causes object to persist
 Reporter:  gertjan                     |       Owner:  somebody
     Type:  defect                      |      Status:  new     
 Priority:  normal                      |   Milestone:  0.10.0  
Component:  Other                       |     Version:  0.8.0   
 Keywords:  import, garbage collection  |  

Comment(by gertjan):

 My apologies for missing that.

 As an after-note, in my hunt for memory leaks today I discovered the
 module, and out of curiosity went back to vizualize what exactly happens
 scipy is imported this way. The result (attached) nicely summarizes
 yesterday's conclusions.

 class A( object ):
   def __init__( self ):
     import scipy


 import objgraph
 objgraph.show_backrefs( objgraph.by_type('A'), max_depth=99,
 filename='backrefs.png' )

Ticket URL: <http://projects.scipy.org/scipy/ticket/1501#comment:10>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.

More information about the Scipy-tickets mailing list