ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

Task: Convert usage from PassiveWeakDictionary<TKey, TValue> to ConditionalWeakTable<TKey, TValue>

Open NightOwl888 opened this issue 2 years ago • 1 comments

In .NET 4.0+ there is now a ConditionalWeakTable<TKey, TValue> class that ties directly into the GC in native code, which can be used as a direct replacement for PassiveWeakDictionary<TKey, TValue>.

It should be possible to use this as a drop-in replacement as it has the same constraints, same key comparison, and same APIs, except for it is lacking a Dispose() method and instead relies on a finalizer to clean up unmanaged resources.

NightOwl888 avatar May 10 '22 23:05 NightOwl888

It looks safe to replace to me. It's used to associate TypeWrappers with ghost objects. No unmanaged resources involved.

wasabii avatar May 23 '22 15:05 wasabii