I am getting the following error on execution of a multi-threading program
java.lang.OutOfMemoryError: Java heap space
The above error occu
Local variables are located on the stack. Heap space is occupied by objects.
You can use the -Xmx
option.
Basically heap space is used up everytime you allocate a new object with new
and freed some time after the object is no longer referenced. So make sure that you don't keep references to objects that you no longer need.