Skip to content

[Native Image] Issues with the memory management command line options for native-image #10957

Closed
@Jack272Hughes

Description

@Jack272Hughes

Describe the issue
We are having a similar issue as to what is detailed in #10499. We too are using the latest JDK 21 CE version of GraalVM with a Spring application, and are noticing that the -Xmx and -Xms arguments aren't working as expected.

We are otherwise not using any other options and rely on the defaults with the final command being ./application -Xmx512m -Xms512m

When building the image we are using the following arguments for the native-image tool itself:

  • --gc=serial
  • --static
  • --libc=musl

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. Build native image
  2. Run native image using options -Xmx512m and -Xms512m

Describe GraalVM and your environment:

More details
Screenshot of the metrics provided by Spring actuator metrics detailing the max and committed bytes

Image

Actual
Given a max and min heap size of 512m, the compiled application states it can use a maximum of 526.5 MB (14.5 more than expected) and the total memory allocated to the process is ignored and is instead dynamically allocated based on the memory it needs.

Expected
Given the same max and min heap. When the application starts it should be able to use a maximum of 512MB and have 512MB already allocated to the process.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions