It depends on the version and on the garbage collectors. I found that java 1.8.0_73 sometimes releases small amounts back to the OS by default. This is the earliest version that I remember seeing it without the need to configure JVM parameters, but it can be applied very well to earlier ones, I do not know the exact version.
If the parameters are not configured, by default it will probably not release anything if 60-70% of your heap is not used.
This may lead to an opinion about performance - java had a reputation for being slow, so by default, the JVM may try to minimize the allocation from the OS and make garbage collection as efficient as possible, holding onto large memory and making it less common.
I wonder if it could be less mean with memory if the OS has relatively little free memory left.?
nsandersen Jan 12 '17 at 14:09 on 2017-01-12 14:09
source share