#715: Parents probably not reclaimed due to too much caching
--------------------------------------------------+-------------------------
       Reporter:  robertwb                        |         Owner:  somebody    
     
           Type:  defect                          |        Status:  
needs_review     
       Priority:  major                           |     Milestone:  sage-5.0    
     
      Component:  coercion                        |    Resolution:              
     
       Keywords:  weak cache coercion Cernay2012  |   Work issues:              
     
Report Upstream:  N/A                             |     Reviewers:  Jean-Pierre 
Flori
        Authors:  Simon King                      |     Merged in:              
     
   Dependencies:  #9138, #11900, #11599, #11521   |      Stopgaps:              
     
--------------------------------------------------+-------------------------

Old description:

> Here is a small example illustrating the issue.
>
> The memory footprint of the following piece of code grows indefinitely.
>
> {{{
> sage: K = GF(1<<55,'t')
> sage: a = K.random_element()
> sage: while 1:
> ....:     E = EllipticCurve(j=a); P = E.random_point(); 2*P; del E, P;
>
> }}}
> E and P get deleted, but when 2*P is computed, the action of integers on
> A, the abelian group of rational points of the ellitpic curve, gets
> cached in the corecion model.
>
> A key-value pair is left in coercion_model._action_maps dict:
>
> (ZZ,A,*) : IntegerMulAction
>
> Moreover there is at least also references to A in the IntegerMulAction
> and one in ZZ._action_hash.
>
> So weak refs should be used in all these places if it does not slow
> things too much.
>
> '''To be merged with #11521'''. Apply:
>
>  * [attachment:trac_715-one_triple_dict-take2.patch]
>  * [attachment:trac_715-reviewer-take2.patch]
>  * [attachment:trac_715-rebase_11599-take2.patch]
>  * [attachment:trac_715-size_t-take2.patch]
>
> and '''then''' the tickets from #11521.

New description:

 Here is a small example illustrating the issue.

 The memory footprint of the following piece of code grows indefinitely.

 {{{
 sage: K = GF(1<<55,'t')
 sage: a = K.random_element()
 sage: while 1:
 ....:     E = EllipticCurve(j=a); P = E.random_point(); 2*P; del E, P;

 }}}
 E and P get deleted, but when 2*P is computed, the action of integers on
 A, the abelian group of rational points of the ellitpic curve, gets cached
 in the corecion model.

 A key-value pair is left in coercion_model._action_maps dict:

 (ZZ,A,*) : IntegerMulAction

 Moreover there is at least also references to A in the IntegerMulAction
 and one in ZZ._action_hash.

 So weak refs should be used in all these places if it does not slow things
 too much.

 '''To be merged with #11521'''. Apply:

  * [attachment:trac_715_combined.patch]

 and '''then''' the tickets from #11521.

--

Comment (by SimonKing):

 I have just attached a combined patch, created by simply folding all
 patches that were previously to be applied.

 With ''only'' that patch, I obtain a single doctest error:
 {{{
 sage -t -force_lib "devel/sage/sage/structure/coerce_dict.pyx"
 **********************************************************************
 File
 
"/mnt/local/king/SAGE/stable/sage-5.0.beta13/devel/sage/sage/structure/coerce_dict.pyx",
 line 210:
     sage: len(LE)    # indirect doctest
 Expected:
     1
 Got:
     50
 }}}
 However, this is to be merged together with #11521, and with both tickets
 together the error vanishes (at least on 64 bit). So, from my point of
 view, it is a positive review, but we should wait for Jean-Pierre's
 results on 32 bit.

 For the patchbot:

 Apply trac_715_combined.patch

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