I too am curious how this is implemented for practical reasons. We run software that is running out of memory at 10GB. Just after startup the smallest heap footprint I can get seems to be around 3.5 GB. I have tried opening with eclipse MAT, yourkit and jhat to no avail (they all seem to like to try to use about 80% of the heap size on top of the memory used to load the .hprof file wholesale). I am hoping to find a way to break the file in managable chunks or write a jhat tool that lazily loads some of this huge pill of data. Anyway, so far I have run into this site
http://www.java2s.com/Open-Source/Java-Document/6.0-JDK-Modules-sun/tools/sun/tools/jmap/JMap.java.htm which at least gives an idea of where to look in the openJDK and lists the code of the JMap class itself. I will post more as I find it.