Home Hosting Domains IT Services Support Contact Us
MyAccount PortalClient AreaAnnouncementsKnowledgebaseSupport TicketsDownloads

Knowledgebase
You are here: MyAccount Portal > Knowledgebase > Technical Support > How do increase the Java heap size so I can escape the java.lang.Outofmemory error?

How do increase the Java heap size so I can escape the java.lang.Outofmemory error?

If Java runs out of memory, the following error occurs:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

This can have two reasons:

  • Your Java application has a memory leak. There are tools like YourKit Java Profiler that help you to identify such leaks.
  • Your Java application really needs a lot of memory (more than 128 MB by default!). In this case the Java heap size can be increased using the following runtime parameters:
java -Xms<initial heap size> -Xmx<maximum heap size>

An example of the command is:

java -Xms32m -Xmx128m

You can set this either in the Java Control Panel or on the command line, depending on the environment you run your application.



Was this answer helpful?

Add to Favourites
Print this Article

Also Read


Network Status Client Area Knowledgebase Datacentre  
 
Terms of ServicePrivacy PolicyCustomer Security