V8中的堆栈和堆(JavaScript) [英] stack and heap in V8 ( JavaScript)

查看:261
本文介绍了V8中的堆栈和堆(JavaScript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

V8是否像JVM一样使用堆栈和堆?
如果是这样,它将原语放在堆栈上和堆上的对象上?

does V8 uses stack and heap like the JVM? if so does it put primitives on the stack and objects on the heap?

推荐答案

是的,V8使用堆类似于JVM和大多数其他语言。但是,这意味着将局部变量(作为一般规则)放在堆栈中的对象和堆中的对象上。例如,如果函数关闭这些值,则这可能不成立。
与在JVM中一样,如果基元存储在局部变量中,它们只能存储在堆栈中。

Yes, V8 uses a heap similar to JVM and most other languages. This, however, means that local variables (as a general rule) are put on the stack and objects in the heap. This may for instance not hold if a function closes over these values. As in the JVM, primitives can only be stored on the stack if they are stored in a local variable.

作为用户,它不是你想要的东西通常需要担心。

As a user it is not something you would normally need to worry about.

这篇关于V8中的堆栈和堆(JavaScript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆