java.lang.OutOfMemoryError: Java heap space

前端 未结 11 1259
温柔的废话
温柔的废话 2020-11-22 08:01

I am getting the following error on execution of a multi-threading program

java.lang.OutOfMemoryError: Java heap space

The above error occu

11条回答
  •  甜味超标
    2020-11-22 08:45

    You can get your heap memory size through below programe.

    public class GetHeapSize {
        public static void main(String[] args) {
            long heapsize = Runtime.getRuntime().totalMemory();
            System.out.println("heapsize is :: " + heapsize);
        }
    } 
    

    then accordingly you can increase heap size also by using: java -Xmx2g http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html

提交回复
热议问题