Ganesh Sahu
Ganesh Sahu

Reputation: 41

How does JVM interpret memory arguments?

I have a doubt around the -Xms and other memory argument parameters. Since JVM is a C/C++ implemented program so whenever we try to pass on memory arguments at the runtime does it internally use Malloc/Calloc to assign memory to our Java program ?

Upvotes: 1

Views: 69

Answers (1)

Roland Illig
Roland Illig

Reputation: 41625

To find out how the HotSpot JVM implements the specification, you can have a look at the actual code.

http://hg.openjdk.java.net/jdk9/jdk9/hotspot/file/tip/src/share/vm/runtime/arguments.cpp

Look for size_t max_heap or match_option(option, "-Xmx" and follow the code from there.

Since HotSpot is written in C++, it will probably not use malloc/calloc, but new/delete, but even more probably some kind of mmap.

Upvotes: 1

Related Questions