#18905: fix more leaks found in #18897
---------------------------+------------------------
       Reporter:  dimpase  |        Owner:
           Type:  defect   |       Status:  new
       Priority:  major    |    Milestone:  sage-6.8
      Component:  memleak  |   Resolution:
       Keywords:           |    Merged in:
        Authors:           |    Reviewers:
Report Upstream:  N/A      |  Work issues:
         Branch:           |       Commit:
   Dependencies:  #18897   |     Stopgaps:
---------------------------+------------------------

Comment (by SimonKing):

 I think I know a potential solution.

 The problem, by the above analysis: The polynomial ring cache is a weak
 value dictionary. Generally, a strong reference chain from key to value
 will prevent garbage collection of the key-value pair.

 I suggest to remove the "global" polynomial ring cache. Instead, I suggest
 that the polynomial ring constructor uses a weak value dictionary that is
 stored as an attribute of the base ring (e.g., in `self.__cached_methods`,
 which is available for all parents).

 The weakly referenced values are polynomial rings. The keys are the list
 of variable names and information on term order and implementation---so,
 strong references to them shouldn't be problematic.

 In that model, a strong reference chain from the base ring to the
 polynomial ring would NOT prevent garbage collection, since in the worst
 case it is a reference cycle (base ring <-> polynomial ring).

--
Ticket URL: <http://trac.sagemath.org/ticket/18905#comment:32>
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.
For more options, visit https://groups.google.com/d/optout.

Reply via email to