java.lang.OutOfMemoryError: Java heap space

前端 未结 11 1089
温柔的废话
温柔的废话 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条回答
  •  旧时难觅i
    2020-11-22 08:52

    1. Local variables are located on the stack. Heap space is occupied by objects.

    2. You can use the -Xmx option.

    3. 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.

提交回复
热议问题