Heap space out of memory

前端 未结 9 1781
梦如初夏
梦如初夏 2020-11-27 04:33

My application currently consumes quite a lot of memory because it is running physics simulations. The issue is that consistently, at the 51st simulation, Java will throw an

9条回答
  •  忘掉有多难
    2020-11-27 05:23

    There is no way to dynamically increase the heap programatically since the heap is allocated when the Java Virtual Machine is started.

    However, you can use this command

    java -Xmx1024M YourClass
    

    to set the memory to 1024

    or, you can set a min max

    java -Xms256m -Xmx1024m YourClassNameHere
    

提交回复
热议问题