Slackbot
04/09/2022, 6:18 PMKuba Petržílka
04/09/2022, 6:21 PMephemient
04/09/2022, 6:25 PMephemient
04/09/2022, 6:36 PMChris Lee
04/09/2022, 6:36 PMKuba Petržílka
04/09/2022, 7:26 PMVampire
04/09/2022, 8:06 PMCristianGM
04/09/2022, 11:49 PMKuba Petržílka
04/10/2022, 3:16 PM-XX:ReservedCodeCacheSize
to 6400K
but that doesn't have significat impact..Kuba Petržílka
04/10/2022, 3:23 PMChris Lee
04/10/2022, 4:34 PMKuba Petržílka
04/10/2022, 5:20 PM-XX:MaxMetaspaceSize=256m
so it shouldn't be more 293 .. but still it doesn't give the total resident memory sizeChris Lee
04/10/2022, 5:50 PMChris Lee
04/10/2022, 5:50 PMChris Lee
04/10/2022, 5:56 PM-XX:ReservedCodeCacheSize
to reduce memory, though this can come at a significant performance penalty. for server-class configurations the ergonomics sets this to 240m, for client-class configurations 48m.Chris Lee
04/10/2022, 6:10 PM240m - Code Cache
256m - Metaspace
512m - Heap
xxx - threads (thread count * stack size)
---
~1GB (max)
As only the max sizes are set it's up to the JVM when to allocate more memory; usually a good idea to set the minimum and maximum memory sizes to the same to avoid surprises (and fragmentation) when the JVM subequently attempts to allocate memory
-set InitialCodeCacheSize and ReservedCodeCacheSize to the same value
-set MetaspaceSize and MaxMetaspaceSize to the same value
-set -Xms and -Xmx to the same value
It can help to add `-XX:+AlwaysPreTouch` to force all memory pages to be initialized at startup (vs on allocation at a later time)
Kuba Petržílka
04/11/2022, 8:42 AM./gradlew -Dorg.gradle.jvmargs='-Xverify:none -XX:ReservedCodeCacheSize=240m -Xss1m -Xmx512m -Xms512m -XX:+AlwaysPreTouch -XX:MaxMetaspaceSize=256m -Dkotlin.daemon.jvm.options=-Xmx256m' --max-workers=1 --no-build-cache --no-configuration-cache distributionWithSsoTest testClasses;
and visualVM shows 512M heap, 256M meta space, 89 threads
So my expectation for resident memory would be:
512M heap
256M meta space
240M code cache (not shown in visaulvm)
89*1 = 89M thread stack
which is 1097M in total, but htop shows ~1520M so I assume those remaining 423M are used by shared libraries? Is there a way how to monitor it as well?Kuba Petržílka
04/11/2022, 9:09 AMKuba Petržílka
04/11/2022, 9:14 AMKuba Petržílka
04/11/2022, 9:15 AMKuba Petržílka
04/11/2022, 12:13 PMroot@9adabf8bda0c:/# jcmd 8993 VM.native_memory summary
8993:
Native Memory Tracking:
(Omitting categories weighting less than 1KB)
Total: reserved=1598761KB, committed=1159449KB
but htop says that the resident memoery is 1.6G