#14711: Weak references in the coercion graph
-------------------------------------+-------------------------------------
Reporter: jpflori | Owner: davidloeffler
Type: defect | Status: needs_work
Priority: critical | Milestone: sage-5.13
Component: number fields | Resolution:
Keywords: memleak, number | Merged in:
field, QuadraticField | Reviewers:
Authors: Simon King | Work issues: String repr. of
Report Upstream: N/A | weakened maps; copying/pickling of
Branch: | maps
u/SimonKing/ticket/14711 | Commit:
Dependencies: | 5168cfd15d4cdbaa3ffdbd4be0f7d783f77257c7
| Stopgaps:
-------------------------------------+-------------------------------------
Comment (by nbruin):
Replying to [comment:119 SimonKing]:
> I wonder: Would it make sense to implement a generic comparison for
maps, based on the dictionary returned by `self._extra_slots({})`? Namely,
these data are used for pickling and copying of maps, and thus it seems
reasonable to me that two maps are equal if and only if the pickling data
coincide.
And the "weakened" copies of maps (with in the near future an easily
distinguished string rep) would be ''equal'' to their counter parts? That
may well be a desirable choice, but by no means uncontroversial. I don't
think in coercion we ever depend on equality testing on maps do we? I
think it's better done on a separate ticket.
Another suggestion about how to get the the strong references in for
register_coercion. If the maps put in by register_coercion are used
afterwards many times to derive other cached coercion maps from, it would
perhaps be preferable to have them in a form that is readily usable for
that, i.e., as "weakened" maps (it means the map can go straight into map
compositions etc.). Otherwise we may well end up making copies repeatedly
in the coercion framework.
We could get the strong connections in by, for instance, referencing the
domains explicitly, say on an attribute
`_domains_with_registered_coercions_to_here`. The coercion map itself
could simply live in the normal cache, as a weakened map.
The same applies to `_register_embedding`, although perhaps the coercion
discovery treats the store differently, and storing a strong reference to
even a weakened map implies a strong reference to the codomain.
Other question, does `_parent=None` imply a weakened map? (I guess
isinstance(_domain,weakref.ref) definintely does) or are there other
reasons for the parent to be unset?
--
Ticket URL: <http://trac.sagemath.org/ticket/14711#comment:120>
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.