Check and Increase JVM heap size on windows and Linux machine

Harish K
1 min readAug 14, 2020

Sometimes, you may come across Exception in thread “main” java.lang.OutOfMemoryError: Java heap space or java.lang.OutOfMemoryError: GC overhead limit exceeded exceptions. These issues may occur because of insufficient heap space on your JVM and to fix these issues, you should increase the heap size.
Command to find out how much heap size your JVM has:
On Windows Machine:
Open command prompt and enter below command:
java -XX:+PrintFlagsFinal -version | findstr /i “HeapSize PermSize ThreadStackSize”

--

--