use case: have a reference to an object without forcing it to stay in memory. don’t need it now? let the garbage collector wipe it now.
might need it later? you can always recreate the object from the reference to use it now.
The WeakRef proposal encompasses two major new pieces of functionality: creating weak references to objects with the…
This use case is very specific to advanced optimising techniques.
This is one thing about the garbage collection process where we always want to see what is happening under the hood. But how do we know?
Finalisers help us with that. So, we could log some information that we’d like to see and when GC (garbage collector) comes into action and remove something from the memory, we get the logged info, therefore helping us debug the app or just understand better what is going on.
We can read the meeting notes for this here.
Interested to dive deeper? See all finished proposals here: https://github.com/tc39/proposals/blob/master/finished-proposals.md