#12313: Fix yet another memory leak caused by caching of coercion data
--------------------------------------------------+-------------------------
Reporter: SimonKing | Owner:
Type: defect | Status:
needs_review
Priority: major | Milestone: sage-5.3
Component: memleak | Resolution:
Keywords: coercion weak dictionary | Work issues:
Report Upstream: N/A | Reviewers: Simon King,
Jean-Pierre Flori, John Perry
Authors: Simon King, Jean-Pierre Flori | Merged in:
Dependencies: #11521, #11599, #12969, #12215 | Stopgaps:
--------------------------------------------------+-------------------------
Comment (by nbruin):
> What would be the problem if the weakrefs survive? OK, at some point the
callback will start working, but would that be a problem? I mean, if the
callback tries to remove an item that has already been deleted, then the
callback would simply do nothing
Not if there's now a new entry stored under that id. The trick is,
`id(object)` is guaranteed to uniquely identify `object` for its lifetime
but, as you've seen, not beyond it.
By the way, as long as we ensure that absolutely no-one else keeps a
reference to our weakrefs, then deleting them should make them disappear
immediately, making it impossible to pass them as a parameter to a
callback ... I hope that python uses that to purge its callback queue
after a cyclic garbage collection.
See #13387 for a modification of `MonoDict` and `TripleDict` to not use a
refcache. It's also a little more careful in handling dangling weakrefs (I
think).
Hashtables should not have a particularly small number of buckets! About
1.5 times the number of elements! (the birthday paradox still means quite
some collisions). And we since we don't ever resize down, the load could
drop quite low! (although not particularly in our main applications).
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/12313#comment:166>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.