2 ms·
Well kinda; even in a tracing GC language like C# you have things like WeakEventManager (https://learn.microsoft.com/en-us/dotnet/api/system.windows.weakeventma
by miffy900 1y ago
Well kinda; even in a tracing GC language like C# you have things like WeakEventManager (https://learn.microsoft.com/en-us/dotnet/api/system.windows.weakeventmanager?view=windowsdesktop-9.0&viewFallbackFrom=net-9.0 https://learn.microsoft.com/en-us/dotnet/api/system.windows....) to prevent memory leaks when using callbacks as event handlers. It is definitely not exclusive to ref counted languages.
In C#, these aren't the exact same as a reference cycle, but the end result is the same, a memory leak:
https://learn.microsoft.com/en-us/dotnet/desktop/wpf/events/weak-event-patterns https://learn.microsoft.com/en-us/dotnet/desktop/wpf/events/...