java.lang.OutOfMemoryError: Java heap space

前端 未结 11 1029
温柔的废话
温柔的废话 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:31

    If you want to increase your heap space, you can use java -Xms -Xmx on the command line. By default, the values are based on the JRE version and system configuration. You can find out more about the VM options on the Java website.

    However, I would recommend profiling your application to find out why your heap size is being eaten. NetBeans has a very good profiler included with it. I believe it uses the jvisualvm under the hood. With a profiler, you can try to find where many objects are being created, when objects get garbage collected, and more.

提交回复
热议问题