简体   繁体   English

了解哪些对象收集了垃圾

[英]Know what objects got garbage collected

when I look at the memory consumption of my java app I expierience a strange behavior: 当我查看我的Java应用程序的内存消耗时,我遇到一种奇怪的行为:

The application allocates 500 MB in ~10 Minutes and then the garbage collector frees the 500 MB. 应用程序在约10分钟内分配了500 MB,然后垃圾回收器释放了500 MB。 Then, 500 MB gets allocated and freed again, and again and again. 然后,一次又一次地分配和释放500 MB。

There are no users on the application - the application is in stand by. 该应用程序上没有用户-该应用程序处于备用状态。

Can you give me a hint how to detect why the application allocates 500 MB? 您能否给我一个提示,如何检测应用程序为什么分配500 MB?

Thanks 谢谢

You can use JVisualVM from your JDK to analyze memory usage. 您可以使用JDK中的JVisualVM来分析内存使用情况。

You should open your application and take a memory dump, you'll see how much memory is allocated by different classes. 您应该打开应用程序并进行内存转储,您将看到不同类分配了多少内存。 It can point you to right directions. 它可以为您指出正确的方向。

Is this server side or client side application. 是此服务器端或客户端应用程序。

You can take a memory dump and look inside. 您可以进行内存转储并查看内部。 Depending on OS tools can very. 取决于操作系统的工具可以非常。

Alternative would be to use JProfiler. 替代方法是使用JProfiler。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM