#11521: Use weak references to cache homsets
-------------------------------+--------------------------------------------
       Reporter:  jpflori      |         Owner:  robertwb         
           Type:  defect       |        Status:  positive_review  
       Priority:  major        |     Milestone:  sage-pending     
      Component:  coercion     |    Resolution:                   
       Keywords:  sd35         |   Work issues:                   
Report Upstream:  N/A          |     Reviewers:  Jean-Pierre Flori
        Authors:  Simon King   |     Merged in:                   
   Dependencies:  #11900 #715  |      Stopgaps:                   
-------------------------------+--------------------------------------------

Old description:

> Originally, this ticket was about the following memory leak when
> computing with elliptic curves:
>
> {{{
> sage: K = GF(1<<55,'t')
> sage: a = K.random_element()
> sage: while 1:
> ....:     E = EllipticCurve(j=a); P = E.random_point(); 2*P;
> }}}
> This example is in fact solved by #715. However, while working on that
> ticket, another leak has been found, namely
>
> {{{
> sage: for p in prime_range(10^5):
> ....:     K = GF(p)
> ....:     a = K(0)
> ....:
> sage: import gc
> sage: gc.collect()
> 0
> }}}
> So, I suggest to start with #715 and solve the second memory leak on top
> of it. It seems that a strong cache for homsets is to blame. I suggest to
> use the weak `TripleDict` instead, which were introduced in #715.
>
> '''To be merged with #715'''. Apply
>
> * the patches from #715
> * [attachment:trac11521_triple_homset.patch]
> * [attachment:trac_11521-reviewer.patch]

New description:

 Originally, this ticket was about the following memory leak when computing
 with elliptic curves:

 {{{
 sage: K = GF(1<<55,'t')
 sage: a = K.random_element()
 sage: while 1:
 ....:     E = EllipticCurve(j=a); P = E.random_point(); 2*P;
 }}}
 This example is in fact solved by #715. However, while working on that
 ticket, another leak has been found, namely

 {{{
 sage: for p in prime_range(10^5):
 ....:     K = GF(p)
 ....:     a = K(0)
 ....:
 sage: import gc
 sage: gc.collect()
 0
 }}}
 So, I suggest to start with #715 and solve the second memory leak on top
 of it. It seems that a strong cache for homsets is to blame. I suggest to
 use the weak `TripleDict` instead, which were introduced in #715.

 '''To be merged with #715'''. Apply

 * the patches from #715
 * [attachment:trac_11521_homset_weakcache_combined.patch]

--

Comment (by SimonKing):

 I have created a combined patch, by folding the two patches (i.e., mine
 and Jean-Pierre's reviewer patch).

 With #715 and this patch, all doctests pass on my machine. So, from my
 perspective, it is a positive review, but we should wait for Jean-Pierre's
 results on 32 bit.

 For the patchbot:

 Apply trac_11521_homset_weakcache_combined.patch

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