Changes between Version 5 and Version 7 of Ticket #715


Ignore:
Timestamp:
07/04/11 08:38:12 (8 years ago)
Author:
jpflori
Comment:

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 #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...

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #715

    • Property Cc jpflori added
  • Ticket #715 – Description

    v5 v7  
    1 (Moving this to "coercion", which is clearly where it belongs.)
     1Here is a small example illustrating the issue.
     2
     3The memory footprint of the following piece of code grows indefinitely.
     4
     5{{{
     6sage: K = GF(1<<55,'t')
     7sage: a = K.random_element()
     8sage: while 1:
     9....:     E = EllipticCurve(j=a); P = E.random_point(); 2*P; del E, P;
     10
     11}}}
     12E 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.
     13
     14A key-value pair is left in coercion_model._action_maps dict:
     15
     16(ZZ,A,*) : IntegerMulAction
     17
     18Moreover there is at least also references to A in the IntegerMulAction and one in ZZ._action_hash.
     19
     20So weak refs should be used in all these places if it does not slow things too much.