Hi!

We are fixing more and more memory leaks. But I wonder if we went too
far in #14058.

Consider the following scenario: You have parents A, B, with elements
a,b. Assume that a+b lives in a parent C different from A and B,
obtained by sage.categories.pushout.pushout(A,B). A typical example is
A=QQ, B=ZZ['x'] and C = QQ['x'].

Currently, the coercion model would keep a strong reference to the
coercion maps from A and B to C. The coercion maps keep strong
references to A, B and C. In particular, C will be kept alive. This
constitutes a memory leak.

With #14058 and its dependencies, there only is a strong reference cycle
involving C and the coercion maps, but the coercion model only keeps a
weak reference to the coercion maps.

By consequence, if you add a+b, but do not keep a strong reference to
the result, then C can be deleted by Python's cyclic garbage collector.
So, the memory leak is fixed.

But I wonder: It is a typical use case to add elements from A and B
frequently and not only once. Do we really want that the parent C may be
constructed repeatedly, unless the user keeps a manual strong reference
to C or disables garbage collection?

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to