Java – can heap memory usage be checked by pool?

I've been trying to optimize a program with many memory leaks The leak has now disappeared, but the occasional operation of the main GC still has a good impact on the older generation of PS I know I can check the basic overall memory information through runtime, but can I check the usage of PS Eden, PS survivor and PS old in the program?

Solution

This article can help you

You can write custom code to analyze memory and data The output will be in the form

collection time: 82037
collection count: 116
PS Survivor Space: init = 1703936(1664K) used = 65536(64K) committed = 32047104(31296K) max = 32047104(31296K)
PS Eden Space: init = 10551296(10304K) used = 0(0K) committed = 69795840(68160K) max = 113049600(110400K)
PS Old Gen: init = 27983872(27328K) used = 239432344(233820K) committed = 357957632(349568K) max = 357957632(349568K)
Code Cache: init = 2555904(2496K) used = 19949568(19482K) committed = 20185088(19712K) max = 50331648(49152K)
PS Perm Gen: init = 21757952(21248K) used = 148450536(144971K) committed = 155058176(151424K) max = 268435456(262144K)

OK, read

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>