If a program throws the error java.lang.OutOfMemoryError: Java heap space, it simply means that the program while running has exhausted all the heap space and even the garbage collector has not been able to reclaim the heap space from unused
How to simulate java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space is an error (not an exception) which is thrown by the Java Virtual Machine (JVM) to indicate that it has run out of heap space. You are trying to create new object(s) but the amount of