Reduce unused heap size in JVM

This was asked similarly here and here , but not a single change in the JVM parameters led me to the same solution. I just want to reduce the size of the unused JVM heap so that it more accurately reflects the actual usage (freeing it from the OS). I use YourKit to profile memory usage and usually looks like this:

enter image description here

I am running intellIj IDEA Community Edition 64-bit, on Windows 7 64-bit, 8 GB RAM. I edited the .vmoptions file found here: C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 14.1.5\bin\idea64.exe.vmoptions with the suggestions mentioned in the links above. The first answer to the link is actually erroneous / outdated, but 2 comments link to found articles here and here that seem promising. The thing is, I tried using all the various garbage collectors mentioned above and still see the same (not identical) heap size shown above.

How to reduce the size of the allocated heap (olive green) to more accurately reflect the actual use (blue)? If garbage collection does not reduce the size of the heap, do not increase it as it is currently.

I tried to configure my idea64.exe.vmoptions as follows:

According to the last link above, she states

Only serial GC and G1 free up unused memory for OS

It even visually shows how the heap is reduced. However, I was unlucky and tried all of the following: what is happening?

-XX:+UseSerialGC

and

-XX:-UseSerialGC

and

 -XX:+UseG1GC 

and

 -XX:-UseG1GC 

and

 Both of the above together, with and without ("+/-") 

and

 -XX:-UseAdaptiveSizePolicy -XX:-UseParallelGC 

and

-XX:UseConcMarkSweepGC

and

 -Xms128m -Xmx750m -XX:MaxPermSize=350m -XX:ReservedCodeCacheSize=225m -XX:+UseG1GC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true -Djsse.enableSNIExtension=false 

and

 -server -Xms128m -Xmx512m -XX:MaxPermSize=250m -XX:ReservedCodeCacheSize=150m -XX:UseConcMarkSweepGC -XX:SoftRefLRUPolicyMSPerMB=50 -ea -Dsun.io.useCanonCaches=false -Djava.net.preferIPv4Stack=true 

EDIT:

To repeat why this is not a duplicate, the other "answer" is 5 years old and not one of the modern garbage collectors is mentioned. The only useful parts are the two links in the comments, which indicate the use of different JVM parameters, all of which I tried and did not succeed. I tried these solutions in full and still have not received a result. That is why I urge you to consider this unique, as others are likely to experience the same circular frustration.

+5
source share
1 answer

As far as I know, this is only for the editor. You must paste these settings in the following location:

Run> Change Configurations ...> VM Settings

Parameters should work if they are placed inside vmoption programs.

+2
source

All Articles