Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I start a JVM with Eden space so big, it runs to completion without any GC. Assuming I have heap of free mem

If I have plenty of memory to spare, can I start a Java application( says mMven ) to run using Eden space alone until completion without any GC ?

like image 498
HoaPhan Avatar asked Sep 04 '18 15:09

HoaPhan


2 Answers

Yes, I have done this for real applications in Java 6+. I started with a 24 GB Eden space, tiny survivor and tenured spaces. Later I found 8 GB was more than enough.

It would still GC when there was a bug or error, but not under normal operation.

I believe the options were

-Xmn24g -Xmx26g -XX:SurvivorRatio=100

With the default GC.

The application was optimised to produce less than 1 GB/hour so run for a day with a GC.

like image 111
Peter Lawrey Avatar answered Sep 19 '22 13:09

Peter Lawrey


Yes but not in Java 8. Java 11 will include Epsilon GC (JEP 318) that does nothing to free memory. With any other GC and with large enough heap there is no need to trigger StopTheWorld garbage collection but it isn't guaranteed that it won't happen.

like image 23
user158037 Avatar answered Sep 22 '22 13:09

user158037