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

Comment (by nbruin):

 > After finishing the tests, there is a `RuntimeError` "Unable to start
 gap", and the stack is
 > {{{
 > (<frame object at 0x1408240>,
 
'/mnt/local/king/SAGE/prereleases/sage-5.3.beta2/local/lib/python2.7/weakref.py',
 51, 'remove', ['                del self.data[wr.key]\n'], 0)
 > }}}
 >
 This is in the removal callback of a `WeakValueDictionary`. So, what I
 *think* is
 happening is that an object that is dependent on Gap for its equality test
 is
 used in a cache somewhere.

 Probably during shutting down, the value gets deleted and the dictionary
 gets
 its callback to remove the value. However, this is during shutdown! Things
 are
 in funny states. Probably, the deletion from the dictionary doesn't really
 matter anyway, because that's probably next in line to be destroyed.

 However, the callback doesn't know that!

 This is a nasty complication of these weakreffed dictionaries: the
 callback code
 can run under funny conditions and an equality test can involve a lot in
 some
 sage objects.

 If we could tell our `WeakValueDictionaries` something about their
 codomain
 their callback could check if that still exists. If not then none of the
 entries
 matter, so you don't have to bother to locate the appropriate key. Just
 delete
 them all.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:199>
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