#12313: Fix yet another memory leak caused by caching of coercion data
-------------------------+--------------------------------------------------
   Reporter:  SimonKing  |          Owner:  rlm                     
       Type:  defect     |         Status:  needs_review            
   Priority:  major      |      Milestone:  sage-5.0                
  Component:  memleak    |       Keywords:  coercion weak dictionary
Work_issues:             |       Upstream:  N/A                     
   Reviewer:             |         Author:  Simon King              
     Merged:             |   Dependencies:  #715                    
-------------------------+--------------------------------------------------

Comment(by SimonKing):

 I have extended my patch by another coercion-related application of
 `MonoDict`.

 I found that `sage.categories.groupoid.Groupoid` is often resulting in a
 memory leak. For example, by #715, polynomial rings are only weakly
 cached. But if the groupoid of a polynomial ring is created, then a
 ''strong'' reference on the polynomial ring is created, preventing it from
 being garbage collected. But a groupoid is created as soon as there is an
 action of that polynomial ring on another ring. Hence, a memory leak.

 The new patch version is overriding the `__classcall__` method of
 `sage.categories.groupoid.Groupoid` (that would normally be inherited from
 `UniqueRepresentation`) by a method that uses a `MonoDict` for caching. In
 addition, there is now only a weak reference to the underlying set of a
 groupoid. By consequence, if there is no other strong reference then
 `Groupoid(P)` can be garbage collected, but a strong reference to P
 prevents `Groupoid(P)` from being garbage collected.

 Still needs review.

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