Reputation: 141
I want to build a MemoryWarningSystem as described in many articles: e.g. as in http://www.javaspecialists.eu/archive/Issue092.html.
Therefore, I want to identify the tenured space like this:
private MemoryPoolMXBean findTenuredGenPool() {
for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
if(pool is tenured space)
return tenured
}
}
I have seen two different ways to identify tenured space
pool.getType() == MemoryType.HEAP && pool.isUsageThresholdSupported()
" Problem with 1: What about CMS Old Gen? What about other tenured spaces? Should I add all of them to the List of Tenured Names?
Problem with 2: Is this a "safe" way of retrieving the tenured space? Is it reliable?
Thanks!
Upvotes: 5
Views: 687
Reputation: 8399
For HotSpot JVM possible memory pool name for old space
Tenured Gen
PS Old Gen
CMS Old Gen
G1 Old Gen
For JRockit
Old Space
Upvotes: 1