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 to analyze java heap hprof files under mac platform

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

This article mainly explains "how to analyze java heap hprof files under the mac platform". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to analyze java heap hprof files under the mac platform".

Use the jhat command that comes with jdk

How to print stack information to a hprof file

Run the program to add VM parameters:

-XX:+HeapDumpOnOutOfMemoryError # will print that when a memory overflow exception occurs, Dump will quickly find the current memory heap for analysis

Step 1:

In the command line interface, execute the following command, where java_pid73912.hprof is the file name

Jhat java_pid73912.hprof

Executing the command will output

Reading from java_pid73912.hprof...Dump file created Thu Apr 08 22:18:08 CST 2021Snapshot read, resolving...Resolving 818890 objects...Chasing references Expect 163 dots. .Eliminating duplicate references.... .Snapshot resolved.Started HTTP server on port 7000Server is ready.

When it is seen that Server is ready. After that, it can be accessed through the ip + port address browser. I am local, so it is localhost:7000.

Clicking Show instance counts for all classes (including platform) will display the information of the class that contains the platform.

Clicking Show instance counts for all classes (excluding platform) will display information about all classes that do not include the platform.

You can see that the class that takes up the most space here is class com.geniu.book.deepinJVM.chapter2.TestHeapOOM$OOMObject, which has more than 800,000 instances.

In this way, we can analyze the objects in memory and analyze the abnormal situation when the memory overflow occurs.

Other proposed options:

1) use the idea plug-in JProfiler

2) minidump_stackwalk tool, which can read dump files

Thank you for your reading, the above is the content of "how to analyze java heap hprof files under the mac platform". After the study of this article, I believe you have a deeper understanding of how to analyze java heap hprof files under the mac platform. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

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

Internet Technology

Wechat

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

12
Report