impact of a high heap memory on the JVM

1

What is the impact of having a high memory heap in the JVM? Does the Garbage Collector take longer to clear memory when it is too high (about 12gb)? If so, is there any way to avoid this delay programmatically without using infrastructure solutions?

    
asked by anonymous 11.06.2014 / 15:08

1 answer

1

The size of the memory will impact the runtime of the Garbage Collector, but not directly. Time will depend on the amount of objects allocated.

The GC traverses all references and marks the objects that are still referenced. Any remaining objects will be available for collection. However, the GC does not immediately rotate for each deallocated object.

I do not have a benchmark on that. However, I use an Eclipse with a maximum of 2GB of memory which I never close because the computer is hibernated. Hardly it exceeds 1GB, because the deallocated objects are collected before the memory increases greatly. So, although the maximum quantity is much larger, I do not feel the effects of a GC running with full memory.

In your case, there could be problems if something close to 12 GB is used and too much memory is allocated and deallocated constantly, forcing the GC to run several times.

But you can not predict without knowing the nature of the application and its architecture. Also because you can use different techniques to force the GC to execute more or less, for example keep variables in static chache.

See how the GC works in my response to How Garbage Collection is implemented in Go?

    
11.06.2014 / 21:32