I read the description of WeakMap and he said:
In native WeakMaps, references to key objects are stored "weakly", which means that they do not prevent garbage collection if there is no reference to the object .
From this I understand that WeakMaps are used when you are trying to use JavaScript garbage collection. What I donβt understand fundamentally is the line that I highlighted.
Why on a regular map objects that do not have links to them will not be collected by garbage? What is the advantage for this and should I explicitly remove from regular Maps?
"Why, on a regular map, objects that do not have links to them will not collect garbage?" because the map itself has a link to the object. As long as there is a link, the object is not hidden. - Felix Kling
in normal Map , Map is a reference to an object
Map
Source: https://habr.com/ru/post/1237964/More articles:Counting the number of columns in a numpy array - pythonHow to decide what promise will then be / catch according to - javascriptSymfony 3.0 and HWIOAuthBundle not working together? - phpCapturing system from browser - firefoxJavascript arrays? - javascriptpython - How to get high and low envelope of a signal? - pythonIs there a way to detect push deployments within a Swift project? - swiftHow to get sound envelope using python? - pythonspinning the spinner from the top of the spinner - androidWhy install dictating a shallow copy to yourself? - pythonAll Articles