Win a copy of Java EE 8 High Performance this week in the Java/Jakarta EE forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

help with MemoryPoolMXBeans  RSS feed

Ranch Hand
Posts: 959
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A sun developer article suggests code similar to this

Running this (hotspot) might show:

Memory type=Non-heap memory, Pool name=Code Cache,
Memory usage=init = 163840(160K) used = 1724608(1684K) committed = 1736704(1696K) max = 33554432(32768K)

Memory type=Heap memory, Pool name=Eden Space,
Memory usage=init = 524288(512K) used = 287792(281K) committed = 524288(512K) max = 71565312(69888K)

Memory type=Heap memory, Pool name=Survivor Space,
Memory usage=init = 65536(64K) used = 65536(64K) committed = 65536(64K) max = 8912896(8704K)

Memory type=Heap memory, Pool name=Tenured Gen,
Memory usage=init = 1441792(1408K) used = 1735896(1695K) committed = 2093056(2044K) max = 715915264(699136K)

Memory type=Non-heap memory, Pool name=Perm Gen,
Memory usage=init = 8388608(8192K) used = 11914720(11635K) committed = 12058624(11776K) max = 67108864(65536K)

Ok, this code is simple enough, but it doesn't quite let me do
what I want, which is to determine peak total memory usage.

I could sum all the p.getPeakUsage() values in a loop, but
that isn't likely to be accurate because if a bunch of objects
move from the Eden space to the Survivor space they will be
counted twice.

What am I missing here?
[ March 08, 2006: Message edited by: Brian Cole ]
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!