执行 jmap 时 JVM 是否停止? [英] Is a JVM stopped while executing jmap?

查看:88
本文介绍了执行 jmap 时 JVM 是否停止?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 jmap 进行内存转储时,我的 java 应用程序是否继续运行?

Does my java application continue running while jmap is taking its memory dump?

推荐答案

您的应用程序已停止.获得准确堆转储的唯一实用方法是在创建转储时停止所有应用程序活动.

Your application is stopped. The only practical way to get an accurate heap dump would be to stop all application activity while the dump is being created.

这是短暂"暂停还是长时间"暂停取决于倾倒了多少.如果您使用-dump",那么您将转储整个堆,包括无法访问的对象.如果您使用-dump:live",您将只转储可访问的对象……但这也需要(至少)标记堆以找出哪些对象是可访问的.

Whether this is a "brief" pause or a "long" pause depends on how much is dumped. If you use "-dump" then you will dump the entire heap, including unreachable objects. If you use "-dump:live" you will only dump reachable objects ... but that also entails (at least) marking the heap to figure out which objects are reachable.

但是,如果您要转储 GB 大小的堆,则预计暂停时间将以分钟而不是秒为单位.

But if you are dumping a gigabyte sized heap, expect the pause time to be measured in minutes rather than seconds.

关于您可以通过使用 fork 避免停止 JVM 的建议,事实证明 fork 多线程进程可能有问题:

Re the suggestion that you could avoid stopping the JVM by using fork, it turns out that forking a multi-threaded process can be problematic:

然后是资源使用问题.

这篇关于执行 jmap 时 JVM 是否停止?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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