Skip to content
New issue

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

JVM 内存结构中的疑问 #10

Open
Mrtj2016 opened this issue Feb 28, 2020 · 1 comment
Open

JVM 内存结构中的疑问 #10

Mrtj2016 opened this issue Feb 28, 2020 · 1 comment

Comments

@Mrtj2016
Copy link

第一节——JVM 内存结构

Java 虚拟机栈的栈顶的栈帧是当前正在执行的活动栈,也就是当前正在执行的方法,PC 寄存器也会指向这个地址。只有这个活动的栈帧的本地变量可以被操作数栈使用,当在这个栈帧中调用另一个方法,与之对应的栈帧又会被创建,新创建的栈帧压入栈顶,变为当前的活动栈帧。

对于上述引用中被加粗的地方,如果要使用静态变量怎么办呢?

@allan-deng
Copy link

静态变量在方法区中,不在虚拟机栈中。此情况下静态变量仍可被使用

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants