#13394: Write a WeakValueDictionary with safer key removal
-------------------------------+-------------------------
Reporter: nbruin | Owner: rlm
Type: enhancement | Status: new
Priority: major | Milestone: sage-5.13
Component: memleak | Resolution:
Keywords: | Merged in:
Authors: | Reviewers:
Report Upstream: N/A | Work issues:
Branch: | Commit:
Dependencies: | Stopgaps:
-------------------------------+-------------------------
Comment (by SimonKing):
Replying to [comment:6 nbruin]:
> If instead you "inline" the tuples by making the bucket a list with the
layout `[key1, weakref_to_value1, key2, weakref_to_value2,...]` you can
save yourself some overhead.
Good point.
In addition, I think that `weakref_to_value_n.key` used for the callback
should be improved: Storing `hash(key_n)` should be enough. Namely, it
allows to find the correct hash bucket, and then the hash bucket is
searched to find `weakref_to_value_n` that is subject to the callback. The
latter is simply comparing memory addresses.
--
Ticket URL: <http://trac.sagemath.org/ticket/13394#comment:7>
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.