RFR: 8376125: Out of memory in the CDS archive error with lot of classes [v3]
Xue-Lei Andrew Fan
xuelei at openjdk.org
Mon Feb 2 23:37:55 UTC 2026
On Mon, 2 Feb 2026 20:17:15 GMT, Ashutosh Mehra <asmehra at openjdk.org> wrote:
>> Yes. Please refer to test/hotspot/jtreg/resourcehogs/runtime/aot/LargeArchive.java, where the archive size is more than 2GB. Without this update, the test will fail.
>
> umm, I removed this change to `os.cpp` and ran `LargeArchive.java` test on x86-64 system and it passed. On which platform/OS did you see the failure?
I was on MacOS. Here is the failure if revert os.cpp update:
% make test TEST="test/hotspot/jtreg/resourcehogs/runtime/aot/LargeArchive.java" JTREG="JAVA_OPTIONS=-Dtest.archive.large.all.workflows=true"
...
[0.018s][info][aot] JVM_StartThread() ignored: java.lang.ref.Reference$ReferenceHandler
[0.018s][info][aot] JVM_StartThread() ignored: java.lang.ref.Finalizer$FinalizerThread
[0.039s][info][cds] Loading classes to share ...
[0.039s][info][cds] Parsing LargeArchive.classlist
[0.047s][info][aot] JVM_StartThread() ignored: jdk.internal.misc.InnocuousThread
[136.124s][info][cds] Parsing /Users/xuelei.fan/workspace/openjdk/jdk-xf.git/build/macosx-aarch64-server-release/images/jdk/lib/classlist (lambda form invokers only)
[136.126s][info][cds] Loading classes to share: done.
[136.127s][info][aot] Rewriting and linking classes ...
[136.245s][info][aot] Rewriting and linking classes: done
[136.245s][info][aot] Regenerate MethodHandle Holder classes...
[136.344s][info][aot] Regenerate MethodHandle Holder classes...done
[136.351s][info][cds] Dumping shared data to file: LargeArchive.static.jsa
[136.351s][info][cds] Gathering all archivable objects ...
[136.371s][info][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_F: dynamically generated
[136.371s][info][cds] Skipping java/lang/invoke/BoundMethodHandle$Species_J: dynamically generated
[136.413s][info][cds] Skipping jdk/internal/misc/CDS$UnregisteredClassLoader$Source: used only when dumping CDS archive
[136.413s][info][cds] Skipping jdk/internal/misc/CDS$UnregisteredClassLoader: used only when dumping CDS archive
[136.417s][info][cds] Heap range = [0x00000003c0000000 - 0x00000004c0000000]
[136.430s][info][aot] Archived 7975 interned strings
[136.431s][info][cds] Gathering classes and symbols ...
[143.110s][info][cds] Sorting symbols ...
[143.113s][info][cds] Sorting classes ...
[149.873s][info][cds] Reserved output buffer space at 0x0000007000000000 [34359738368 bytes]
[149.900s][info][cds] Allocating RW objects ...
[149.954s][info][cds] done (46510 objects)
[149.954s][info][cds] Allocating RO objects ...
[151.033s][info][cds] done (142334 objects)
[151.033s][info][cds] Relocating embedded pointers in core regions ...
[152.400s][info][cds] Relocating 150345176 pointers, 0 tagged, 17461 nulled
[152.400s][info][aot] Make classes shareable
[152.558s][info][cds] Number of classes 4485
[152.558s][info][cds] instance classes = 4340, aot-linked = 0, inited = 0
[152.558s][info][cds] boot = 838, aot-linked = 0, inited = 0
[152.558s][info][cds] vm = 153, aot-linked = 0, inited = 0
[152.558s][info][cds] platform = 0, aot-linked = 0, inited = 0
[152.558s][info][cds] app = 3502, aot-linked = 0, inited = 0
[152.558s][info][cds] unregistered = 0, aot-linked = 0, inited = 0
[152.558s][info][cds] (enum) = 30, aot-linked = 0, inited = 0
[152.558s][info][cds] (hidden) = 8, aot-linked = 0, inited = 0
[152.558s][info][cds] (old) = 0, aot-linked = 0, inited = 0
[152.558s][info][cds] (unlinked) = 0, boot = 0, plat = 0, app = 0, unreg = 0
[152.558s][info][cds] obj array classes = 136
[152.558s][info][cds] type array classes = 9
[152.558s][info][cds] symbols = 93208
[153.627s][info][aot] sorting heap objects
[153.628s][info][aot] computed ranks
[153.629s][info][aot] sorting heap objects done
[153.635s][info][aot] Size of heap region = 1461632 bytes, 31877 objects, 13159 roots, 0 native ptrs
[153.642s][info][aot] oopmap = 4 ... 365408 ( 0% ... 100% = 99%)
[153.642s][info][aot] ptrmap = 35175 ... 142547 ( 19% ... 78% = 58%)
[153.642s][info][aot] Dumping symbol table ...
[153.652s][info][aot] Archived 0 method handle intrinsics (16 bytes)
[153.652s][info][aot] Adjust lambda proxy class dictionary
[153.652s][info][cds] Make training data shareable
[153.890s][info][cds] Shared file region (rw) 0: 305713152 bytes, addr 0x0000000800004000 file offset 0x00004000 crc 0xa7da7141
[154.232s][info][cds] Shared file region (ro) 1: 3269057552 bytes, addr 0x0000000812394000 file offset 0x12394000 crc 0xdce21a0b
[154.237s][error][cds] An error has occurred while writing the shared archive file.
[154.237s][error][cds] Unable to write to shared archive.
[154.237s][error][cds] Unable to seek to position 3574808575 (errno=9: Bad file descriptor)
[154.237s][info ][cds] An error has occurred while processing the shared archive file. Run with -Xlog:aot,cds for details.
[154.237s][info ][cds] unrecoverable error
Error occurred during initialization of VM
Unable to use shared archive. Unrecoverable archive loading error (run with -Xlog:aot,cds for details): unrecoverable error
];
stderr: []
exitValue = 1
java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
at jdk.test.lib.process.OutputAnalyzer.shouldHaveExitValue(OutputAnalyzer.java:549)
at jdk.test.lib.cds.CDSAppTester.executeAndCheck(CDSAppTester.java:219)
at jdk.test.lib.cds.CDSAppTester.dumpStaticArchive(CDSAppTester.java:319)
at jdk.test.lib.cds.CDSAppTester.runStaticWorkflow(CDSAppTester.java:470)
at jdk.test.lib.cds.SimpleCDSAppTester.runStaticWorkflow(SimpleCDSAppTester.java:196)
at LargeArchive.main(LargeArchive.java:77)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
at java.base/java.lang.reflect.Method.invoke(Method.java:565)
at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
at java.base/java.lang.Thread.run(Thread.java:1516)
JavaTest Message: Test threw exception: java.lang.RuntimeException: Expected to get exit value of [0], exit value is: [1]
JavaTest Message: shutting down test
...
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/29494#discussion_r2756468548
More information about the hotspot-dev
mailing list