Java heap space out of memory
问题 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 error usually because of a heap space out of memory (my program eventually runs thousands of simulations). Is there anyway I can not just increase the heap space but modify my program so that the heap space is cleared after every run so that I can run an arbitrary number of simulations? Thanks -edit- Thanks guys. Turns