Changes between Version 61 and Version 88 of Ticket #715

Jan 3, 2012, 10:42:28 PM (11 years ago)
Simon King

I have attached another patch, which implements the ideas sketched above. I think it corresponds to what you suggested ("use a weak reference from the action to the domain").

One detail: We have to distinguish between the underlying set, the domain and the codomain of an action. In fact, the new patch only uses a weak reference to the underlying set, and introduces a cdef function (hence, hopefully with little overhead) returning it.

I consider sage-5.0.prealpha0 plus trac11780_unique_auxiliar_polyring.patch (probably not needed) plus trac715_two_tripledicts.patch plus trac715_weak_action.patch.

At least sage -t sage/modular/modsym/ passes, but I need to run the whole test suite.

The example from the ticket description does not leak. However, if the j-invariant varies, it seems that for each elliptic curve one copy is preserved:

sage: K = GF(1<<55,'t')
sage: for i in range(500):
....:     a = K.random_element()
....:     E = EllipticCurve(j=a)
....:     P = E.random_point()
....:     Q = 2*P
sage: import gc
sage: gc.collect()
sage: from sage.schemes.generic.homset import SchemeHomsetModule_abelian_variety_coordinates_field
sage: LE = [x for x in gc.get_objects() if  isinstance(x,SchemeHomsetModule_abelian_variety_coordinates_field)]
sage: len(LE)

In any case, the original leak is fixed with the two patches. The question is whether the second patch suffices to keep actions alive, whether it avoids a regression, and whether all tests pass.

If everything is alright, we may still try to find out where the remaining strong reference to an elliptic curve comes from.


  • Ticket #715

    • Property Status changed from needs_review to needs_work
    • Property Work issues changed from to avoid regression
  • Ticket #715 – Description

    v61 v88  
    24 [attachment:trac715_two_tripledicts.patch]
     24 * [attachment:trac715_two_tripledicts.patch]
     25 * [attachment:trac715_weak_action.patch]