查看 permgen 中对象的工具

发布于 2024-09-24 22:28:53 字数 71 浏览 0 评论 0原文

我在永久生成溢出方面遇到一些问题。我可以使用哪些工具来查看哪些类现在已加载到 permgen 中以及它们使用了多少内存? 谢谢。

I have some problems with permgen overflow. What tools I can use to view what classes are now loaded into permgen and how much memory they use?
Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

两个我 2024-10-01 22:28:53

也许您有一个很大的代码库或者正在实习大量的字符串。

尝试 jmap :(

jmap -permstat <pid>

注意:permstat选项在Windows中不可用)

示例:

$ jmap -permstat 22982
Attaching to process ID 22982, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 17.0-b16
100691 intern Strings occupying 5641096 bytes.
finding class loader instances ..Finding object size using Printezis bits and skipping over...
done.
computing per loader stat ..done.
please wait.. computing liveness..done.
class_loader    classes bytes   parent_loader   alive?  type

<bootstrap>     303     1355992   null          live    <internal>
0xdd159fe8      9       94104   0xdd153c30      live    sun/misc/Launcher$AppClassLoader@0xae7fcfa0
0xdd153c30      0       0         null          live    sun/misc/Launcher$ExtClassLoader@0xae7b0178

total = 3       312     1450096     N/A         alive=3, dead=0     N/A

您还可以尝试将堆转储到文件中,然后将其加载到Eclipse 内存分析器,它将为您提供有用的信息,例如泄漏嫌疑报告和支配树。

jmap -dump:format=b,file=heap.bin 22982

如有必要,您可以使用 -XX:MaxPermSize JVM 选项来增加 PermGen 空间。

Maybe you have a large code base or are interning lots of strings.

Try jmap:

jmap -permstat <pid>

(Note: the permstat option is not available in Windows)

Example:

$ jmap -permstat 22982
Attaching to process ID 22982, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 17.0-b16
100691 intern Strings occupying 5641096 bytes.
finding class loader instances ..Finding object size using Printezis bits and skipping over...
done.
computing per loader stat ..done.
please wait.. computing liveness..done.
class_loader    classes bytes   parent_loader   alive?  type

<bootstrap>     303     1355992   null          live    <internal>
0xdd159fe8      9       94104   0xdd153c30      live    sun/misc/Launcher$AppClassLoader@0xae7fcfa0
0xdd153c30      0       0         null          live    sun/misc/Launcher$ExtClassLoader@0xae7b0178

total = 3       312     1450096     N/A         alive=3, dead=0     N/A

You can also try dumping the heap to a file and then loading it into Eclipse Memory Analyser, which will give you useful information such as a Leak Suspects Report and Dominator Tree.

jmap -dump:format=b,file=heap.bin 22982

If necessary, you can increase your PermGen space by using the -XX:MaxPermSize JVM option.

稳稳的幸福 2024-10-01 22:28:53

看起来您搜索的是一个探查器。 (例如 jProfiler 或开源:http://java-source.net/open-source/profilers)

Looks like what you search is a profiler. (for example jProfiler or for open source : http://java-source.net/open-source/profilers)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文