Questions tagged [ephemeron]

Ephemerons is intended for questions related to garbage collection of key/value data structures where the key might be reachable from the value

An ephemeron has pointers to key and value objects; the value is reachable if both the ephemeron and the key are reachable. In an ephemeron table, a value is only alive when its key is alive.

In the .Net CLR, the DependentHandle class an implementation of ephemerons. In ECMAScript-6, WeakSet and WeakMap are implemented as ephemeron tables. In GNU Smalltalk, finalization is implemented with ephemerons.

References

3 questions
33
votes
1 answer

Should ConditionalWeakTable be used for non-compiler purposes?

I've recently come across the ConditionalWeakTable class in my search for an IDictionary which uses weak references, as suggested in answers here and here. There is a definitive MSDN article which introduced the class and which…
rikoe
  • 1,639
  • 1
  • 21
  • 29
1
vote
2 answers

Two-way WeakMap keeping objects alive?

Assume I have two WeakMaps: a2b = new WeakMap(); b2a = new WeakMap(); If I now do: a2b.set(a, b); b2a.set(b, a); Will this keep both a and b alive or will they be finalized if nobody else is holding on to either a or b?
user3612643
  • 5,096
  • 7
  • 34
  • 55
1
vote
2 answers

Looking for the name of a design pattern

VBScript guarantees that the GC will run after every line, so if you create an object and don't keep a reference, its destructor will be called at the end of the line. This allows you to do a number of interesting things, one of which is simulating…