impact of a high heap memory on the JVM

Asked

Viewed 320 times

1

What is the impact of having a high heap memory on the JVM? Does Garbage Ollector take longer to clear the memory when it is too high (around 12gb)? If yes, is there any way to prevent this delay programmatically, without using infrastructure solutions?

  • There is no way to predict when the GC goes into action, just trust it. Java is a high-level language, the intention is just not to think about memory and things like.

  • I know this, my problem is that I suspect that the system delay in some moments is related to GC activity wiping the memory heap. Does memory size impact this process? This is my question...

1 answer

1


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

GC scans all references and marks objects that are still referenced. Remaining objects will be available for collection. However, the GC does not rotate immediately for each displaced object.

I don’t have a benchmark for that. However, I use a daily Eclipse with a maximum of 2GB of memory which I never close because the computer is hibernated. It is hardly more than 1GB, because the objects are collected before the memory increases too much. So although the maximum amount is much higher, I don’t feel the effects of a GC running with full memory.

In your case, there may be problems if something close to 12 GB is used and a lot of memory is constantly allocated and de-located, forcing GC to run multiple times.

But it is not possible to predict without knowing the nature of the application and its architecture. Because one can use different techniques to force the GC to perform more or less, for example keep variables in static chache.

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

Browser other questions tagged

You are not signed in. Login or sign up in order to post.