Changes between Initial Version and Version 1 of Ticket #14711, comment 69


Ignore:
Timestamp:
10/03/13 17:55:30 (6 years ago)
Author:
nbruin
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #14711, comment 69

    initial v1  
    22> I think this is not the case with the branch that I have just uploaded. I did
    33
    4 Got it! Thanks. To have documented ''why'' we're OK here: `_coerce_from_hash` is a `TripleDict`, so it holds a ''strong'' reference to the map stored. This is what keeps the map alive. However, when one of the domain or codomain (or category; whatever the third key component is) vanishes, then the `TripleDict` callback will remove the entry and hence the strong reference to the map. This makes it possible for the map to be GCed. So the required callback to clean up is already triggered via the key triple.
     4Got it! Thanks. To have documented ''why'' we're OK here: `_coerce_from_hash` is a `MonoDict`, so it holds a ''strong'' reference to the map stored. This is what keeps the map alive. However, when the domain vanishes, then the `MonoDict` callback will remove the entry and hence the strong reference to the map. This makes it possible for the map to be GCed. So the required callback to clean up is already triggered via the key triple.
    55
    66> What weakrefs are you talking about? Those to domain and codomain?
    77> And what would the callback be supposed to do?
    88
    9 Indeed, domain and codomain. So those callbacks are already taken care of by `_coerce_from_hash` being a `TripleDict`.
     9Indeed, domain and codomain. So those callbacks are already taken care of by `_coerce_from_hash` being a `MonoDict`. The codomain is actually not relevant for this (and would be strongly referenced by the map anyway -- perhaps "weakened" maps should only have their domain reference weakened and parent (reference to the homset) cleared? If we just always keep codomain strongly referenced compositions would naturally keep things alive guaranteed anyway. Virtually all maps have a strong ref to the codomain (via generator images) internally anyway, so putting it explicitly on the outside shouldn't hurt much.
    1010
    1111> A different story is `_coerce_from_list`, which is a list. Here, we might need to take care of defunct maps. Perhaps the maps there shouldn't be weakened in the first place (`_coerce_from_list` is filled by `register_coercion()`, and perhaps it would make sense to keep these maps strong), but I am not sure if this wouldn't re-introduce the `QuadraticField` leak I have just fixed.