#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:27 SimonKing]:
 > Replying to [comment:25 jpflori]:
 > > Not sure about the other uses of morphism though, a morphism could
 then survive when its parent dies.
 >
 > Isn't the homset containing the morphism keeping a strong reference to
 domain and codomain, too? Or did I change this somewhere? So, would having
 a weak reference to the domain actually help?
 Don't know, we'll have to check.
 >
 > > But whats the point of keeping a morphism alive if you don't use its
 parent?
 >
 > Well, imagine a method that returns a morphism. You have constructed the
 domain and the codomain inside of the method. It would be awkward to
 return `domain, codomain, morphism` instead of only one item, `morphism`.
 But if the morphism only keeps a weak reference to the domain, and if you
 only return the morphism, then the domain might be garbage collected
 during return, and this would make the morphism useless.
 Yeah I got that if you don't store an outside refernce to the domain, then
 it will get gc'ed.

 But I don't really see what kind of method would return just such a
 morphism, internally constructing the domain without you providing it (or
 having other references ot it somehow), do you have actual examples in
 mind?

 Anyway, another solution would be to add an option to Action/Morphism and
 so on to only use weakref optionally.

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