#715: Parents probably not reclaimed due to too much caching
------------------------+---------------------------------------------------
Reporter: robertwb | Owner: somebody
Type: defect | Status: new
Priority: major | Milestone: sage-4.7.1
Component: coercion | Keywords:
Work_issues: | Upstream: N/A
Reviewer: | Author:
Merged: | Dependencies:
------------------------+---------------------------------------------------
Old description:
> (Moving this to "coercion", which is clearly where it belongs.)
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.
--
Comment(by jpflori):
With the piece of code in the desrciption, there is only one reference to
these objects in that ZZ._hash_actions dictionary because to build it we
test if A1 == A2 and not A1 is A2 as in coercion_model._action_maps, and
because of the current implementation of ellitpic curves, see
http://groups.google.com/group/sage-
nt/browse_thread/thread/ec8d0ad14a819082 and
[http://trac.sagemath.org/sage_trac/search/opensearch?q=ticket%3A11474
#11474], and decause the above code use only one j-invariant, only ones
gets finally stored.
However with random curves, I guess there would be all of them.
About the weakref, the idea should more be to build something like
WeakKeyDictionnary if it does not slow down coercion too much...
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/715#comment:7>
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.