I am getting the following error on execution of a multi-threading program
java.lang.OutOfMemoryError: Java heap space
The above error occu
1.- Yes, but it pretty much refers to the whole memory used by your program.
2.- Yes see Java VM options
-Xms set initial Java heap size
-Xmx set maximum Java heap size
Ie
java -Xmx2g
assign 2 gigabytes of ram as maximum to your app
But you should see if you don't have a memory leak first.
3.- It depends on the program. Try spot memory leaks. This question would be to hard to answer. Lately you can profile using JConsole to try to find out where your memory is going to