redhat-developer / redhat-developer/vscode-java
Enable JVM Heap trimming by default
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
@maxandersen and @franz1981 taught me java 17 has support for jvm reclaiming memory back to the os:
- https://bugs.openjdk.org/browse/JDK-8293114 this is the feature
- this is what we have for G1 instead: https://bugs.openjdk.org/browse/JDK-8204089
And Netty behaviour is what's missing from the puzzle (see https://github.com/netty/netty/discussions/11845#discussion-3690282)
Meaning that while idle, https://bugs.openjdk.org/browse/JDK-8204089 just shrink back the heap RSS to xms
we need 2 set of VM args to be passed:
- autotrim interval -> which requires something like -XX:+UnlockExperimentalVMOptions -XX:TrimNativeHeapInterval=5000
- G1 periodic GC: -> G1PeriodicGCInterval, G1PeriodicGCInvokesConcurrent and G1PeriodicGCSystemLoadThreshold (for https://bugs.openjdk.org/browse/JDK-8204089)
OpenJDK supports -XX:+IgnoreUnrecognizedVMOptions, in case users run an older JDK 17 that doesn't support the new flags, and OpenJ9 simply ignores unknown flags, so it's probably safe to try it out on insider builds.
@rgrunber @testforstephen @jdneo WDYT?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review how the extension passes JVM arguments to the Java language server, then compare the requested flags with OpenJDK JDK-8293114 and JDK-8204089 and the referenced Netty discussion. Done means enabling the heap-trimming and G1 periodic-GC options by default while preserving behavior on older JDK 17 versions and OpenJ9.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- developer-experience, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100