java - Default GC for native image springboot apps, and how to change to ZGC - Stack Overflow

admin2025-04-17  3

I have a very simple springboot app, which I build a graalvm native image out of it.

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns=".0.0"
         xmlns:xsi=";
         xsi:schemaLocation=".0.0 .0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.4.2</version>
        <relativePath/>
    </parent>

 <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>

[...]

  <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.graalvm.buildtools</groupId>
                <artifactId>native-maven-plugin</artifactId>
            </plugin>

The native image is created successfully, and can be run, serving traffic etc, happy.

But I was wondering, what is the default GC used in this case?

It seems from the documentation .4.0-M1-Release-Notes#paketo-tiny-builder-for-building-oci-images the default image is paketobuildpacks/builder-jammy-tiny

This base image does not modify the GC. What that said, what is the default GC used?

Finally, I wish to test the "new" ZGC, how to configure the native image to take into account ZGC?

转载请注明原文地址:http://anycun.com/QandA/1744895298a89144.html