java - How to find out where exact young/old gen is located in memory? -
recently able object's address using sun.misc.unsafe class.
and trying find programmatically actual generation object located. want know starting , ending points of each generation. if java (oracle jvm) provides tools resolve issue? believe not, since different gcs require different memory structures (e.g. g1), , makes task more interesting :)
what want know here couple of numbers representing borders of generations in memory, this:
young gen: start point - 8501702198 end point - 9601256348
would love hear craziest ideas black magic allows determine different generation areas placed in memory.
this possible hotspot jvm though somehow complicated.
the key idea use vmstructs
- information hotspot internal constants , types embedded right jvm shared library.
for example, parallelscavengeheap::_young_gen
vm global variable contains pointer psyounggen
structure has _virtual_space
member boundaries of parallel collector's young generation. similarly, gencollectedheap::_gch
global points structure describing cms collector generations.
i've made proof-of-concept project demonstrate usage of vmstructs. pure java, no libraries required, relies on undocumented jdk internals , may not work on java versions. i've tested on jdk 8u40 , jdk 7u80 on windows , linux.
- jvm.java - code reading vmstructs;
- heapinfo.java - sample program addresses of heap generations.
Comments
Post a Comment