Posts Tagged ‘arguments’

java.lang.OutOfMemoryError: Java heap space

Monday, April 14th, 2008

Another easy one that I always forget the recipe. If a Java-based application throws a OutOfMemoryError, you can solve the problem by giving it more memory. Just pass one of these command-line arguments to java.exe:

  • -Xms256m - Java VM will start with a heap of 256mb.
  • -Xmx512m - Java VM will have a maximum heap of 512mb.
  • -XX:PermSize=128m - The permgen space will start with 128mb. This is needed when application instantiates a lot of small objects. It can be explained as the “FAT” (or “EXT3″) of the objects.
  • -XX:MaxPermSize=256m - The permgen space will have a maximum of 256mb.