是JVM在执行jmap时停止了吗? [英] is JVM stopped while executing jmap?

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

问题描述

当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.

但是如果要转储一个千兆字节大小的堆,预计暂停时间以秒或分钟而不是毫秒来衡量。

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

重新建议您可以通过使用fork来避免停止JVM,事实证明,分叉多线程进程可能会有问题:

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:

  • fork in multi-threaded program
  • Multithreaded fork
  • http://www.linuxprogrammingblog.com/threads-and-fork-think-twice-before-using-them

然后就是资源使用问题。

Then there is is the resource usage issue.

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

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