#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:            
Work_issues:            |       Upstream:  N/A       
   Reviewer:            |         Author:            
     Merged:            |   Dependencies:            
------------------------+---------------------------------------------------
Changes (by SimonKing):

  * status:  needs_review => needs_work


Comment:

 In the following example, there is no memory leak that would be caused by
 the `sage.categories.homset` cache:
 {{{
 sage: len(sage.categories.homset._cache.keys())
 100
 sage: for p in prime_range(10^5):
 ....:     K = GF(p)
 ....:
 sage: len(sage.categories.homset._cache.keys())
 100
 }}}

 However, when you do a conversion `K(...)` then a convert map is created,
 and apparently is cached:
 {{{
 sage: for p in prime_range(10^5):
 ....:     K = GF(p)
 ....:     a = K(0)
 ....:
 sage: len(sage.categories.homset._cache.keys())
 9692
 }}}

 The homset cache does use weak references. Hence, it is surprising that
 the unused stuff can not be garbage collected. Apparently there is some
 direct reference involved at some point.

 I am very stronglyagainst removing the cache of `sage.categories.homset`.
 Namely, elliptic curve code uses finite fields and maps involving finite
 fields ''a lot'', and killing the cache is likely to cause a massive
 regression.

 However, since we actually have coercion maps (not just any odd map), I
 expect that the direct reference comes from the coercion model. I suggest
 to look into the coercion code and use weak references there.

 By the way, I don't know why the status is "needs review". I think it
 clearly is "needs work".

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