X Tutup
The Wayback Machine - https://web.archive.org/web/20210207134536/https://github.com/Snailclimb/JavaGuide/issues/868
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

对于static关键字详解一文中,在JDK1.7及以后,被static修饰的成员变量存放的位置应该是在堆中的java镜像(Class实例)的末尾 #868

Open
IdleCatDx opened this issue Jul 28, 2020 · 0 comments

Comments

@IdleCatDx
Copy link

@IdleCatDx IdleCatDx commented Jul 28, 2020

JDK1.6及之前,静态变量存放在方法区中的instanceKlass的末尾,
JDK7以上版本,静态变量存放在Class实例中,Class实例如同堆中其他对象一样,存在于堆中

注:一个对象实例的对象头中的类型指针指向方法区中的instanceKlass,instanceKlass中有个字段java_mirror指向Class实例
可以看一下R大的解释[https://www.zhihu.com/question/50258991]

大佬有空可以看看,这里可能存在一些问题

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

Successfully merging a pull request may close this issue.

None yet
1 participant
X Tutup