id,summary,reporter,owner,description,type,status,priority,milestone,component,resolution,keywords,cc,merged,author,reviewer,upstream,work_issues,branch,commit,dependencies,stopgaps
11521,Use weak references to cache homsets,jpflori,robertwb,"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]
* [attachment:trac_11521_callback.patch]",defect,needs_review,major,sage-5.2,coercion,,sd35,jpflori nthiery,,Simon King,Jean-Pierre Flori,N/A,,,,#12969; to be merged with #715,