Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native build uses a lot of memory #494

Closed
ditogam opened this issue Aug 31, 2023 · 2 comments
Closed

Native build uses a lot of memory #494

ditogam opened this issue Aug 31, 2023 · 2 comments
Labels
question Further information is requested

Comments

@ditogam
Copy link

ditogam commented Aug 31, 2023

Describe the problem
We are using AWS Codebuild to make native image using with graalvm-ce-java17-22.3.2. CodeBuild runs on ubuntu compute type general1.large, which has 8 vcpu and 15 GB of memory.

./gradlew nativeCompile

We tried to move to new graalvm version 17.0.8, downloading from site. After running the build, it failed with exit code 137. As I saw it's due to OutOfMemory.

We also tested same build on desktop pc and build memory usage exceeded 17GB.

Can you help with this issue?

Also, build generates libawt.so and other libraries in output
image

We use AWT to generate image in our app, it fails with java.home property not set as shown in [native-image] java.home property not set

System Info (please complete the following information):

  • OS: [e.g. Ubuntu 22.04.3 LTS]
  • GraalVM Version [e.g. 17.0.8+9.1 (build 17.0.8+9-LTS-jvmci-23.0-b14)]
  • Java Version [e.g. 17]
  • Plugin version [e.g. native-gradle-plugin:0.9.25]
@ditogam ditogam added the question Further information is requested label Aug 31, 2023
@ditogam
Copy link
Author

ditogam commented Aug 31, 2023

graalvmNative {
        binaries {
            main {
                buildArgs.add('-J-Xmx9g')
            }
        }
    }

Helped to resolved memory issue, but Font issue still remains

@fniephaus
Copy link
Member

Could you run with --verbose and report the value for -XX:MaxRAMPercentage? The native-image utility in that release limits itself to available memory at startup, so if not much memory is available, the max heap might be too small for your application. In the upcoming release (GraalVM for JDK 21), we are changing this behavior again (see oracle/graal#7277 for impl details).

If you know that your application needs a certain amount of memory, you could also use Xms instead of Xmx to set a minimum heap, which will also bump the max heap if not more memory is available.

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants