javascript - JS中变量的值是否保存在内存堆中
问题描述
我正在学习 JavaScript 并想了解内存分配在该语言中是如何工作的,因此我遇到了内存堆这个术语,它是保存数据的位置。问题是:
任何类型的值(无论是简单的数字还是巨大的数据结构)都只保存在内存堆中,这是真的吗?
解决方案
The term, "heap," generally refers to an area of memory where things of arbitrary size and purpose are kept, and from which storage is dynamically allocated and released as needed. JavaScript makes extensive use of this for everything it does: variables come into existence for a time, then go away. You can create objects and simply forget about them. Periodically, a "garbage collector" runs through and reclaims things that are no longer actively referenced. All of this sort of thing is what is commonly referred to as "a heap."
推荐阅读
- angular6 - 使用角度 6 中的浏览器后退按钮更改路线
- java - Hibernate 在执行 SELECT 时自动对 ManyToMany 关系执行 DELETE 查询
- symfony - Symfony4 FormType:添加项目时从其他表中的条目中选择
- javascript - 如何防止剑道网格中的页面更改
- tensorflow - tensorflow沿维度选择索引列表
- c# - 创建 .net core 3.0 类库问题
- java - Is it true to say that every run time binding was a static binding during compilation?
- c++ - C++ 宏解包并加入
- c# - 实体框架执行功能不起作用
- doctrine-orm - 向 Doctrine QueryBuilder 的 where-in-clause 添加条件