#12313: Fix yet another memory leak caused by caching of coercion data
-------------------------------------------------+--------------------------
       Reporter:  SimonKing                      |         Owner:               
                                        
           Type:  defect                         |        Status:  needs_work   
                                        
       Priority:  major                          |     Milestone:  sage-pending 
                                        
      Component:  memleak                        |    Resolution:               
                                        
       Keywords:  coercion weak dictionary       |   Work issues:               
                                        
Report Upstream:  N/A                            |     Reviewers:  Simon King, 
Jean-Pierre Flori, John Perry, Nils Bruin
        Authors:  Simon King, Jean-Pierre Flori  |     Merged in:               
                                        
   Dependencies:  #715, #11521, #12215, #13746   |      Stopgaps:               
                                        
-------------------------------------------------+--------------------------
Changes (by nbruin):

  * status:  positive_review => needs_work


Comment:

 Attached patch seems to fix the problem for me. My take is `self.D` can't
 be `None`. You can't go calling `self.__call__()` if `self` has been
 mutilated! On the other hand, it seems that in rare circumstances it can
 be that `self.D.buckets` is already erased, because `D` is in the process
 of being torn down. In that case, the callback is not necessary anyway, so
 we just return.

 I think we just have to live with this: cycle breaking can be arbitrarily
 complicated, so we cannot expect Python to fully protect against it. Any
 routine involved in deallocation has to be prepared to find attributes
 already cleared.

 Exercise: prove or disprove: determining whether a callback triggered by a
 GC needs to be executed is NP-hard.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:267>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to