redhat-developer / redhat-developer/vscode-java

Enable JVM Heap trimming by default

Open
#3,395 8 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
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:

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.