The Java heap size is a security feature: It is there so a Java program can't simply take over the machine by allocating endless amounts of memory.
That's why almost no Java VM has a "increase heap as necessary" option.
As such, it's almost impossible to tell in advance how much memory a Java application or server will need. You will have to run it with real production data to find out. There are tools to help you there but usually, you just wait for the OutOfMemoryError
, make sure it's not due to a bug and then increase the heap (professionals assume that it's not a but and simply increase the heap, then fix the bug and then leave the heap size as it is :-) ).
PS: on this site there is a question "How can I give Java code more than 144 GB of RAM?"