java - Finding out what the NewSize is from code -
is possible display java newsize parameter same way can find heap size?
i know heap size can found using:
runtime.getruntime().maxmemory();
is there similar newsize?
you want memorypoolmxbean
numerical values of eden space , survivor space:
for(java.lang.management.memorypoolmxbean memorypoolmxbean :java.lang.management.managementfactory.getmemorypoolmxbeans()) { system.out.println(""); try { system.out.println("poolname\t" + memorypoolmxbean.getname()); system.out.println("commited\t" + memorypoolmxbean.getcollectionusage().getcommitted()); system.out.println("init\t" + memorypoolmxbean.getcollectionusage().getinit()); system.out.println("max\t" + memorypoolmxbean.getcollectionusage().getmax()); system.out.println("used\t" + memorypoolmxbean.getcollectionusage().getused()); } catch (nullpointerexception npex) { npex.printstacktrace(); } }
output:
poolname code cache java.lang.nullpointerexception @ com.github.lyubent.example.app.main(app.java:40) poolname par eden space commited 0 init 335544320 max 335544320 used 0 poolname par survivor space commited 0 init 41943040 max 41943040 used 0 poolname cms old gen commited 0 init 1728053248 max 1728053248 used 0 poolname cms perm gen commited 0 init 21757952 max 85983232 used 0
Comments
Post a Comment