#14711: Memleak when creating QuadraticField
-------------------------------------------------+-------------------------
       Reporter:  jpflori                        |        Owner:
           Type:  defect                         |  davidloeffler
       Priority:  critical                       |       Status:  new
      Component:  number fields                  |    Milestone:  sage-5.12
       Keywords:  memleak, number field,         |   Resolution:
  QuadraticField                                 |    Merged in:
        Authors:                                 |    Reviewers:
Report Upstream:  N/A                            |  Work issues:
         Branch:  u/SimonKing/ticket/14711       |       Commit:
   Dependencies:                                 |     Stopgaps:
-------------------------------------------------+-------------------------

Comment (by jpflori):

 Replying to [comment:23 SimonKing]:
 > {{{
 > sage:
 
objgraph.show_chain(objgraph.find_backref_chain(random.choice(objgraph.by_type('NumberField_quadratic_with_category')),inspect.ismodule),
 filename='chain.png')
 > }}}
 > shows me the file chain.png in the attachment (of course, subject to
 some random choice).
 >
 > What is happening there? If I am not mistaken, objgraph only shows
 strong references. The quadratic field Q is used as key for the `MonoDict`
 which stores conversions into `CDF`. This monodict has a weak reference to
 the key Q, but a strong reference to the value, which is a morphism. The
 morphism of course points to both domain and codomain, and there is your
 problem.
 >
 > So, how can we break this chain?
 Weakcaching the domain?
 In such a situation it would make sense as in the monodict this domain is
 already only weakcached, in contrast to the codomain which stays alive
 anyway.
 Didn't we do something similar for Action?

 Not sure about the other uses of morphism though, a morphism could then
 survive when its parent dies.
 But whats the point of keeping a morphism alive if you don't use its
 parent?

--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:25>
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/groups/opt_out.

Reply via email to