#11521: Memleak when resolving the action of Integers on an Elliptic Curve
------------------------+---------------------------------------------------
   Reporter:  jpflori   |          Owner:  robertwb   
       Type:  defect    |         Status:  needs_work 
   Priority:  major     |      Milestone:  sage-4.8   
  Component:  coercion  |       Keywords:  sd35       
Work_issues:            |       Upstream:  N/A        
   Reviewer:            |         Author:  Simon King 
     Merged:            |   Dependencies:  #11900 #715
------------------------+---------------------------------------------------

Comment(by jpflori):

 Replying to [comment:95 SimonKing]:
 > Yes, and note that we have two locations for storing the actions: * in
 the coercion model * in the attribute `_action_hash` of parents. I found
 that having weak references in the coercion model is enough for fixing the
 leak - even if one has strong references in `_action_hash`. That is
 something I don't fully understand.
 As I posted above in ZZ._action_hash equality is tested with "==" (rather
 than identity with "is") so in the code of the ticket description where
 only "one" curve is used, only one curve gets stored in _action_hash.
 If you try the code posted some comments above where (really) different
 curves are used, you'll see that the leak is not fixed if you dont use a
 similar approach for _action_hash as for the coercion model.
 >In the example of the ticket description, we have an action of `ZZ`. `ZZ`
 is not subject to garbage collection, hence, having a strong reference in
 `ZZ._action_hash` should keep the action alive, and thus the elliptic
 curve (namely the different copies of E that are created in the loop).
 Anyway, even in that case we would see the drastic slow-down.
 > Indeed that would be the consequence. I think that would not be
 acceptable: If the user keeps an action, then s/he can rightfully expect
 that domain and codomain are automatically kept alive.
 The weakref domain and codomain in functors problem could be tackled by
 adding an optional parameter for the use of weakref.

 By default, the behavior of functors would be as before with strong refs
 (and the option to false).

 For the coercion models we would set the option to True and use weakref
 whenever possible.

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