We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
WeakMap 是在 ES6 中引入的新的数据类型,其中键是弱引用类型,值可以为任何数据类型。WeakMap 的主要特点是,如果键不再被引用,那么它所对应的键值对会自动从 WeakMap 中删除,这意味着 JavaScript 引擎可以在内存紧张的时候及时释放不再使用的内存。
WeakMap 的实现原理是,它内部维护了一个由键对象的引用弱引用而成的列表。当某个键对象的引用计数为零时,这个键对象同时也会被回收,WeakMap 内部的相应条目也会自动被删除。这个过程发生在垃圾回收器执行垃圾回收时。另外,由于 WeakMap 中的键是弱引用类型,所以无法通过键获取值的所有属性和方法,如 size、keys、values、entries、forEach 等,因此 WeakMap 没有这些属性和方法。
Sorry, something went wrong.
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: