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

运行时常量池问题 #836

Closed
zhou-ning opened this issue Jun 28, 2020 · 4 comments
Closed

运行时常量池问题 #836

zhou-ning opened this issue Jun 28, 2020 · 4 comments
Labels

Comments

@zhou-ning
Copy link

@zhou-ning zhou-ning commented Jun 28, 2020

在Java内存区域.md#26-运行时常量池讲解中,作者是说将jdk1.7只是将字符串常量池被从方法区拿到了堆中,但是在JVM垃圾回收.md#25-如何判断一个常量是废弃常量中,作者又 JDK1.7 及之后版本的 JVM 已经将运行时常量池从方法区中移了出来,在 Java 堆(Heap)中开辟了一块区域存放运行时常量池。有点迷糊了,诶诶希望能有正确的回答

@wangpeipei90
Copy link

@wangpeipei90 wangpeipei90 commented Jun 29, 2020

没问题,字符串常量池只是常量池的一种,还有int的常量池对于数字0-255。运行时常量池还可以包括自定义的常量,比如 static的字段

@zhou-ning
Copy link
Author

@zhou-ning zhou-ning commented Jun 30, 2020

没问题,字符串常量池只是常量池的一种,还有int的常量池对于数字0-255。运行时常量池还可以包括自定义的常量,比如 static的字段

意思是1.7版本只是将字符串常量池从方法区中移除吗?

@Snailclimb
Copy link
Owner

@Snailclimb Snailclimb commented Jun 30, 2020

HI,请看下面内容。垃圾回收这部分是没有同步修改的原因。
image

在Java内存区域.md#26-运行时常量池讲解中,作者是说将jdk1.7只是将字符串常量池被从方法区拿到了堆中,但是在JVM垃圾回收.md#25-如何判断一个常量是废弃常量中,作者又 JDK1.7 及之后版本的 JVM 已经将运行时常量池从方法区中移了出来,在 Java 堆(Heap)中开辟了一块区域存放运行时常量池。有点迷糊了,诶诶希望能有正确的回答

@zhou-ning
Copy link
Author

@zhou-ning zhou-ning commented Jun 30, 2020

好的,谢谢

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
3 participants
You can’t perform that action at this time.
X Tutup