#12313: Fix yet another memory leak caused by caching of coercion data
---------------------------------------------------------------------------+
       Reporter:  SimonKing                                                |    
     Owner:                                                       
           Type:  defect                                                   |    
    Status:  positive_review                                      
       Priority:  major                                                    |    
 Milestone:  sage-5.8                                             
      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, #13378; merge with #13387  |    
  Stopgaps:                                                       
---------------------------------------------------------------------------+

Comment (by SimonKing):

 Replying to [comment:320 nbruin]:
 > However, the very statement introduces by #11521 changes that:
 >  - A value in a TripleDict may be stored via a weak reference (this was
 already the case)
 >  - It installs a callback on the weakref that removes the
 keytriple:weakref pair from the dictionary (this IS new).

 And note that originally I did *not* use that callback. So, I wouldn't
 mind to simply revert this patch.

 In other words: Homsets would be stored in a `TripleDict`, via a weak
 reference without a callback. Hence, if the Homset becomes garbage
 collected, then we will have a dead weak references remaining in the
 `TripleDict` (the original purpose of the callback was to remove this dead
 entry). Of course, it is not nice if the dead entry would stay in the
 `TripleDict` forever. But it is conceivable that domain and/or codomain of
 the Homset will become garbage collectable if the Homset becomes garbage
 collectable. Hence, the dead entry would disappear anyway, by means of the
 callbacks from the keys (not from the value).

 Hence, I suggest to not use a callback for the weak reference to a Homset.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:322>
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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to