You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The `-H:Preserve` flag preserves all metadata from module, class-path entry, or a package in the image. This will allow users to more easily support third-party libraries and get more user-friendly experience with Native Image.
The flag can be used in following ways:
1. -H:Preserve=all preserves all elements from the JDK and from the classpath
2. -H:Preserve=module=<module> preserves all elements from a given module
3. -H:Preserve=module=ALL-UNNAMED preserves all elements from the classpath
4. -H:Preserve=package=<package> preserves all elements from a given package
5. -H:Preserve=package=<package-wildcard> preserves all elements from packages captured by the wildcard. For example, -H:Preserve=package=my.app.*.
6. -H:Preserve=path=<cp-entry> preserves all elements from a given class-path entry
7. A combination of any of the previous uses, for example, -H:Preserve=path=<cp-entry>,module<module>
Copy file name to clipboardexpand all lines: substratevm/CHANGELOG.md
+2-1
Original file line number
Diff line number
Diff line change
@@ -4,12 +4,13 @@ This changelog summarizes major changes to GraalVM Native Image.
4
4
5
5
## GraalVM for JDK 25
6
6
* (GR-58668) Enabled [Whole-Program Sparse Conditional Constant Propagation (WP-SCCP)](https://github.com/oracle/graal/pull/9821) by default, improving the precision of points-to analysis in Native Image. This optimization enhances static analysis accuracy and scalability, potentially reducing the size of the final native binary.
7
-
* (GR-59313) Deprecated class-level metadata extraction using `native-image-inspect` and removed option `DumpMethodsData`. Use class-level SBOMs instead by passing `--enable-sbom=class-level,export` to the `native-image` builder. The default value of option `IncludeMethodData` was changed to `false`.
7
+
* (GR-59313) Deprecated class-level metadata extraction using `native-image-inspect` and removed option `DumpMethodsData`. Use class-level SBOMs instead by passing `--enable-sbom=class-level,export` to the `native-image` builder. The default value of option `IncludeMethodData` was changed to `false`.
8
8
* (GR-52400) The build process now uses 85% of system memory in containers and CI environments. Otherwise, it tries to only use available memory. If less than 8GB of memory are available, it falls back to 85% of system memory. The reason for the selected memory limit is now also shown in the build resources section of the build output.
9
9
* (GR-59864) Added JVM version check to the Native Image agent. The agent will abort execution if the JVM major version does not match the version it was built with, and warn if the full JVM version is different.
10
10
* (GR-59135) Verify if hosted options passed to `native-image` exist prior to starting the builder. Provide suggestions how to fix unknown options early on.
11
11
* (GR-61492) The experimental JDWP option is now present in standard GraalVM builds.
12
12
* (GR-55222) Enabled lazy deoptimization of runtime-compiled code, which reduces memory used for deoptimization. Can be turned off with `-H:-LazyDeoptimization`.
13
+
* (GR-54953) Add the experimental option `-H:Preserve` that makes the program work correctly without providing reachability metadata. Correctness is achieved by preserving all classes, resources, and reflection metadata in the image. Usage: `-H:Preserve=[all|none|module=<module>|package=<package>|package=<package-wildcard>|path=<cp-entry>][,...]`.
13
14
14
15
## GraalVM for JDK 24 (Internal Version 24.2.0)
15
16
* (GR-59717) Added `DuringSetupAccess.registerObjectReachabilityHandler` to allow registering a callback that is executed when an object of a specified type is marked as reachable during heap scanning.
AnalysisError.guarantee(type.isArray() || (type.isInstanceClass() && !type.isAbstract()), "Type %s must be either an array, or a non abstract instance class", type.getName());
Copy file name to clipboardexpand all lines: substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/SubstrateOptions.java
+2-2
Original file line number
Diff line number
Diff line change
@@ -1316,8 +1316,8 @@ public enum ReportingMode {
1316
1316
@Option(help = "Deprecated, option no longer has any effect.", deprecated = true, deprecationMessage = "It no longer has any effect, and no replacement is available")//
Preserves all classes and relevant resources from selected classpath entries in the image.
2
+
For the selected classpath entries it is not necessary to provide reachability metadata because all classes, as well as resources not ending in '.class' or '.jar', are included into the image.
3
+
Please note that using this option can result in a significant increase in build time and binary size, as well as a decrease in runtime performance.
0 commit comments