How to Change Java Heap Size in Windows XP

Written by deborah lee soltesz Google
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Change Java Heap Size in Windows XP
(Jupiterimages/Pixland/Getty Images)

Java applications are allocated memory, called "heap" memory, to store data dynamically created during the execution of a program. Java applications launch with a starting amount of heap memory, and may be allocated a maximum amount of heap memory, which is used as the application's needs increase. Typically, the minimum and maximum amounts of allocated heap memory, or "heap size," are determined by the default values for your operating system and version of Java. However, if an application requires more than the maximum allocated amount of memory, an "out-of-memory" error occurs. The starting and maximum heap sizes for a Java application can be set in Microsoft Windows XP by adding or modifying the heap size flags on the Java application shortcut. The maximum amount of heap memory that can be allocated is approximately 1.6 gigabytes.

Skill level:
Easy

Other People Are Reading

Instructions

  1. 1

    Right-click on your Java application shortcut and select "Properties."

  2. 2

    In the "Target" line under the "Shortcut" tab, add the initial heap size flag " -Xms32M " after the word "java" (with a space before and after the flag). This sets the initial heap size for the application to 32 megabytes. If you want the application to start with more or less allocated heap memory, change "32" to the number of megabytes, for example "-Xms128M" for 128 MB.

  3. 3

    Add the maximum heap size flag "-Xmx128M" (with a space before and after the flag). This sets the maximum heap size for the application to 128 MB. If you want the application to have a higher maximum heap size available, change "128" to the number of megabytes your application requires. For example, write "-Xms512M" for 512 MB. The maximum heap size should be larger than the initial heap size.

  4. 4

    Click "OK."

  5. 5

    Click or double-click the shortcut to launch the Java application. If you continue to receive out-of-memory errors, repeat these steps, increasing the value for the maximum heap size flag.

Tips and warnings

  • If you are running a Java application from the command line, simply add the -Xms and -Xmx flags with appropriate values to the command line. For example, to start "myapp" with an initial heap size of 64 MB and maximum heap size of 512 MB, use the command:
  • Java -Xms64m -Xmx512m myapp

Don't Miss

Filter:
  • All types
  • Articles
  • Slideshows
  • Videos
Sort:
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the eHow.co.uk site, you consent to the use of cookies. For more information, please see our Cookie policy.