linghengqian commented on issue #35052:
URL:
https://github.com/apache/shardingsphere/issues/35052#issuecomment-3131228643
> Thanks for your generous help! I understand this isn't a ShardingSphere
issue. I just couldn't find anyone else online mentioning this specific
problem, and since you brought it up, I was hoping for a similar solution. So,
if I understand correctly, the runtime crash is caused by unavailable memory
during compilation, is that right? My build server has 32GB of RAM; could
limiting the memory during compilation help resolve this?
- I will say that I'm not sure limiting memory usage would help. But since
this issue really only affects the Windows ecosystem, I tried something more
aggressive.
- I did the exact opposite on Github Actions Runner on Windows Server 2025.
Even though Github Actions Runner has a maximum memory of `15.62GB`, the
`native-image` command line of GraalVM CE For JDK 24 always tried to use less
than `10GB` of memory to build the GraalVM Native Image.
```shell
Build resources:
- 8.71GB of memory (55.8% of 15.62GB system memory, determined at start)
- 4 thread(s) (100.0% of 4 available processor(s), determined at start)
[junit-platform-native] Running in 'test listener' mode using files matching
pattern [junit-platform-unique-ids*] found in folder
[/home/runner/work/shardingsphere/shardingsphere/test/native/target/test-ids]
and its subfolders.
[2/8] Performing analysis... [******]
(631.8s @ 7.25GB)
GC warning: 456.8s spent in 1279 GCs during the last stage, taking up 70.82%
of the time.
Please ensure more than 9.23GB of memory is available for Native
Image
to reduce GC overhead and improve image build time.
66,278 reachable types (87.7% of 75,576 total)
108,673 reachable fields (54.4% of 199,808 total)
352,047 reachable methods (60.0% of 586,525 total)
83,746 types, 820 fields, and 5,645 methods registered for reflection
131 types, 120 fields, and 118 methods registered for JNI access
4 native libraries: dl, pthread, rt, z
```
- So I directly told the `native-image` command line tool in the CI file to
use `85%` of physical memory. This was written to the buildArg via the GraalVM
Native build Tools Maven plugin. This is also what
https://github.com/oracle/graal/pull/10441 does in a so-called CI environment.
Taking into account
https://www.graalvm.org/jdk24/reference-manual/native-image/overview/BuildConfiguration/#memory-configuration-for-native-image-build,
the `native-image` command line tool runs on the JVM. If you are using a
private gitlab runner or a private github runner, this operation may kill other
processes on the system.
```shell
./mvnw -PnativeTestInShardingSphere -e "-DjvmArgs=-XX:MaxRAMPercentage=85.0"
clean verify
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]