NETMF / netmf-interpreter

.NET Micro Framework Interpreter
http://netmf.github.io/netmf-interpreter/
Other
487 stars 223 forks source link

WeakReference tracks resurrection #239

Open cpfister opened 9 years ago

cpfister commented 9 years ago

In the full .NET framework, WeakReferences by default become null when the garbage collector detects that the corresponding target has become unreachable. After the references are updated, the finalizer is eventually run - and if there is no object resurrection, the memory is reclaimed. An additional flag can be specified if one wishes to track an object during the finalizer and after resurrection.

In the Micro Framework, I observed WeakReferences not becoming null while a finalizer is running. Therefore, I assume that there is a difference to the full framework and that Micro Framework only supports long weak references.

http://msdn.microsoft.com/en-us/library/ms404247(v=vs.110).aspx

I suggest that short weak reference support should be implemented and exposed as the default, and until then that the documentation is updated to point out the difference to the full framework.

lt72 commented 9 years ago

We will update the documentation to reflect the difference in behavior.