Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does java check for memory leaks

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article introduces the knowledge of "how to check memory leaks in java". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Memory leak scenario

Memory leaks are likely to occur when long-lifecycle objects hold references to short-lifecycle objects. Although short-lifecycle objects are no longer needed, they cannot be recycled because long-lifecycle objects hold their references. This is the scenario of memory leaks in Java.

1. CPU and memory usage during viewing:

Top-H-p 58527

2. Check the server memory.

Df-h check the disk condition du-h-- max-depth=1 file directory occupies resources.

3. View memory, cache, usage, and idle.

Free-m

S0C: the capacity of the first survivor (survival area) in the younger generation (in bytes)

S1C: the capacity of the second survivor (survival area) in the younger generation (in bytes)

S0U: the first survivor (survival area) of the younger generation currently uses space (bytes)

S1U: the second survivor (survival area) of the younger generation currently uses space (bytes)

EC: the capacity of Eden (Garden of Eden) in the younger generation (in bytes)

EU: the younger generation Eden (Garden of Eden) currently uses space (bytes)

Capacity of the OC:Old generation (bytes)

Space currently used by the OU:Old generation (bytes)

Capacity of PC:Perm (persistent generation) (bytes)

PU:Perm (persistent generation) currently uses space (bytes)

YGC: the number of gc in the younger generation from application startup to sampling

YGCT: the time taken by gc in the younger generation from application startup to sampling (s)

FGC: the number of old generation (full gc) gc from application startup to sampling

FGCT: time taken by old to replace (full gc) gc from application startup to sampling (s)

GCT: total time taken by gc from application startup to sampling (s)

4. Check the execution program information.

Jstack 2829 > 1.log grep-A 1roomjava.lang.Thread.State' jstack.log | wc-l

Download the heap file analysis code Dump.

This is the end of "how to check for memory leaks in java". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report