简体   繁体   中英

How I can detect and prevent memory leak in Java

I have the following images showing the used memory and the committed memory.

最近 15 分钟的内存快照

  • On the top: used 210 MB and committed 232 MB
  • On the bottom: used 10 MB and committed 232 MB

The following image showing the last 6 hours of memory usage.

最近 6 小时的内存快照

My Question: based on those graphs

  • This application has a memory leak?
  • And how I can detect and prevent this leak?

Thank you.

This application has a memory leak?

No.

And how I can detect and prevent this leak?

When the low point of the zigzag shape keeps being higher than the previous one continuously, and eventually the VM exits with OutOfMemoryError . This isn't happening here - you do not have a memory leak.

Java does not instantly garbage collect all garbage. It lets it build up for a bit, because that's more efficient in the long run.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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