Harald Wellmann
Harald Wellmann

Reputation: 12885

How to set the heap size for GraalVM native image?

How can I control the heap size of a native image created with GraalVM native-image?

Does the native image evaluate the usual JVM -Xmx argument?

Upvotes: 3

Views: 1262

Answers (1)

Szymon Stepniak
Szymon Stepniak

Reputation: 42264

You can specify the heap size with -Xmx{n} command line parameter. For instance,

./your-native-binary -Xmx16m

will set 16m heap size for Substrate VM. You can also add -XX:+PrintGC flag to check garbage collector activity:

./your-native-binary -XX:+PrintGC -XX:+PrintGCTimeStamps -Xmx16m

Upvotes: 6

Related Questions