#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):

 Let me try to recall why the current "weak-referencing coerce maps" are
 made as they are, to understand why we have a strong reference chain to
 `Int_to_IntegerMod`.

 - We have a backtracking algorithm to find coerce maps by transitivity of
 "registered" coerce maps. Hence, registered coerce maps need to be stored
 in the codomain.
 - Since the maps are stored in a container that is stored as an attribute
 of the codomain, there is a strong reference chain from the codomain to
 the coerce map.
 - A strong reference to the codomain should not prevent the domain from
 garbage collection. Hence, IN COERCION, we use a weak reference from the
 map to the domain, and we cut the reference from the map to its parent.
 - A strong reference to the domain should not prevent the codomain from
 garbage collection. That's what seems to fail in the current example.

 What I do not understand: Why is that more than a strong reference CYCLE
 (which would not prevent garbage collection) from the codomain to the map
 and back?

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