-
Notifications
You must be signed in to change notification settings - Fork 448
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable JVM Heap trimming by default #3395
Comments
thanks @fbricon ! |
Seems reasonable. If JDT-LS would look like less of a memory hog, that's nice. After initial project import, I would guess a lot of the heap space could be reclaimed. While on the topic of trimming the heap, there are another set of flags (specific to JDT Core) that I tried out a while ago on eclipse-jdt/eclipse.jdt.core#1526 (comment) that seemed to have promising results. (update: ugh, but on the downside, they may slow down project import.. needs to be tried) |
We can put it in the insiders first and then see if it affects the performance of project import and features such as code completion. |
@rgrunber beware that the 2 features act on different fronts:
|
I ran vscode-java with We do use the parallel GC by default though. See below for the default options we set. Line 253 in 86bf3ae
-XX:MinHeapFreeRatio=5 -XX:MaxHeapFreeRatio=10 as those were 2 options we didn't adopt.
We could potentially, detect if a user has set their own options that include the G1 GC, and if so add our option dynamically prior to starting. We do add some options dynamically in vscode-java/src/javaServerStarter.ts Line 86 in 86bf3ae
|
In order to benefit of this one specifically you should start an application which does something "interesting enough" at startup (eg Quarkus/spring) triggering some native compilation. Later on, after >5 seconds, the JIT arenas can free some memory back to the OS, and in-between 5 seconds (interleaved or not, hence waiting >10 seconds is the safer choice) you can measure the process RSS as described by https://quarkus.io/guides/performance-measure#platform-specific-memory-reporting Sadly, native memory tracking isn't currently able to detect the actual RSS footprint, but just what the OS allocator believe to be its live data (malloc'd not freed yet) and not the actual footprint underlying it. |
Worse, NMT only tells you how much the hotspot has allocated currently, leaving out native memory consumption from the rest of the process. Before the very first trim, you can find out how much memory is retained by the glibc by doing
This info comes from the glibc itself.
You can also find out RSS via jcmd:
|
Many thanks @tstuefe I believe the option to get RSS out of And adding quarkusio/quarkus#36691 (reply in thread) as a positive data point of using trimming, coming from a user. |
@maxandersen and @franz1981 taught me java 17 has support for jvm reclaiming memory back to the os:
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?
The text was updated successfully, but these errors were encountered: