如何在Java中剖析对象创建? [英] How to profile object creation in Java?

查看:116
本文介绍了如何在Java中剖析对象创建?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

与我一起工作的系统创建了大量的对象和垃圾,这些对象和垃圾一直在收集它们,导致堆耗量非常陡峭。我想知道哪些对象正在生成以调整代码,但我无法弄清垃圾收集开始时转储堆的方式。当我尝试通过JConsole随机手动启动dumpHeap时,我总是在GC完成运行后得到结果,并且没有得到任何有用的数据。



如何追踪过多的临时对象的创建是值得欢迎的。

http://kenai.com/projects/btrace/pages/Homerel =nofollow noreferrer> http://kenai.com/projects/btrace/pages/Home ),或者使用 jvisualvm 在JDK 6u18中进行实时内存采样。


The system I work with is creating a whole lot of objects and garbage collecting them all the time which results in a very steeply jagged graph of heap consumption. I would like to know which objects are being generated to tune the code, but I can't figure out a way to dump the heap at the moment the garbage collection starts. When I tried to initiate dumpHeap via JConsole manually at random times, I always got results after GC finished its run, and didn't get any useful data.

Any notes on how to track down excessive temporary object creation are welcome.

解决方案

Have a look at what BTrace can do (http://kenai.com/projects/btrace/pages/Home), alternatively try using jvisualvm in JDK 6u18 which does live memory sampling.

这篇关于如何在Java中剖析对象创建?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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