#15432: Use a callback with a weak reference to WeakValueDictionary
---------------------------+----------------------------
Reporter: nbruin | Owner:
Type: enhancement | Status: new
Priority: major | Milestone: sage-6.0
Component: memleak | Keywords:
Merged in: | Authors:
Reviewers: | Report Upstream: N/A
Work issues: | Branch:
Commit: | Dependencies:
Stopgaps: |
---------------------------+----------------------------
Following http://bugs.python.org/issue417795, we should probably only
reference the dict weakly from the callback object to avoid unnecessary
circular references.
As we found in http://trac.sagemath.org/ticket/15367#comment:39, if an
object C involved in a reference cycle becomes unreachable as a side
effect of circular GC (e.g., a callback somewhere), the object C will only
be collected by GC in the next round. A non-circularly referenced object C
would have its reference count hit 0 and would be collected immediately.
That is already a good reason to try and avoid circular references, even
now that Python does clean them up eventually.
See also http://trac.sagemath.org/ticket/13394#comment:19 (reasoning the
validity of using a strongly referencing closure should be fine in theory
-- this didn't take into account the practical consideration above).
--
Ticket URL: <http://trac.sagemath.org/ticket/15432>
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 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-trac.
For more options, visit https://groups.google.com/groups/opt_out.