Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to check heap memory usage by pool?

I've been working on optimizing a program that was having a lot of issues with memory leaks. The leaks are gone now, but the occasional runs of the major GC still put a good dent in PS old gen. I know that I can check basic overall memory information through Runtime, but is it possible to check usage in PS eden, PS survivor, and PS old from within the program?

like image 598
SaxSalute Avatar asked Jul 17 '15 04:07

SaxSalute


Video Answer


1 Answers

This article can help you out

You can write custom code to analyze memory & 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)

Good read

like image 192
underdog Avatar answered Oct 04 '22 21:10

underdog