JDK Memory Allocation

David Buck david.buck at oracle.com
Sun Jul 22 01:10:35 UTC 2018


Hi Max!

Your question does not seem to be related to building OpenJDK, so I have 
BCCed build-dev from the thread and added gc-dev. That said, I am not 
sure any of the development lists are really an ideal place to ask 
general "code walk through" questions.

If really necessary, memAllocator.cpp [0] would probably be as good a 
place as any to start reading the source code. But unless you intend to 
hack on the JVM itself, trying to read this source code may not be the 
most productive use of your time. You may get a lot more out of reading 
some of the wikis [1], blogs [2], and books [3][4] that cover the 
HotSpot JVM in detail. Even if you ultimately chose to read the source 
code directly, reading these other types of resources first should 
really help you make better sense of what you see in the source code.

Cheers,
-Buck

[0] 
http://hg.openjdk.java.net/jdk/jdk/file/b0fcf59be391/src/hotspot/share/gc/shared/memAllocator.cpp
[1] https://wiki.openjdk.java.net/display/HotSpot/Main
[2] https://shipilev.net/jvm-anatomy-park/
[3] https://www.goodreads.com/book/show/13227108-java-performance
[4] https://www.goodreads.com/book/show/23316035-java-performance-companion

On 2018/07/22 8:51, mr rupplin wrote:
> Having looked for some while at the OpenJDK source code I am unable to find where the memory allocation occurs.  I will be working very much with the JDK and would like to get a firm grasp on its underlying mechanisms.
> 
> public class JustAsk
> {
>       public static void main(String...args)
>       {
>           for(int i=0; i<100; i++)
>           {
>              new JustAsk();
>           }
>       }
> }
> 
> This doesn't seem to rely on any of the functions in the libjli nor of the jni.h.  So clearly where do we look for the handler here?
> 
> Thanks,
> 
> Your friend Max
> 



More information about the hotspot-gc-dev mailing list