Increase the Java memory

Author: Frank Hunt
Date Of Creation: 20 March 2021
Update Date: 23 June 2024
Anonim
How to increase Java heap size (Make Java faster)
Video: How to increase Java heap size (Make Java faster)

Content

Running Java applications on the computer requires some memory, also called the Java memory (Java heap). It is necessary to increase the heap periodically to keep the app's performance from slowing down. Here is an explanation for Windows 7.

To step

  1. Go to Control Panel. Click the "Start" button. Then click on "Control Panel".
  2. Select Programs. On the left side of the Control Panel, click "Programs". Click on "Programs" written in green, and not click "Delete a program" in blue.
  3. Go to Java settings. In the next window, click on "Java", usually under the other programs; the "Java Control Panel" window appears.
  4. Select the "Java" tab. Within this tab, click on the "View" button. This will open the "Java Runtime Environment Settings"
  5. Change the size of the heap. In the column "Runtime Parameters" change the value of the Java memory, or enter a value if the field is empty.
  6. Adjust the parameter. Double-click on the "Runtime Parameters" column to edit the parameters, and:
    • typ -Xms512m - for allocating 512MB of memory for Java.
    • typ -Xms1024m - for allocating 1GB of memory for Java.
    • typ -Xms2048m - for allocating 2GB of memory for Java.
    • typ -Xms3072m - for allocating 3GB of memory for Java, and so on.
    • Note: it starts with a minus sign and ends with an m.
    • Also note that there is no empty space between the characters.
  7. Close the dialog. Click the "OK" button of the "Java Runtime Environment Settings" window to close it.
  8. Close the Java dialog box. "Apply" in the "Java control panel" is now activated. Click that button to confirm the new Java memory. Then click "OK".
  9. Close the Windows 7 Control Panel.

Tips

  • If Java cannot find enough memory, it passes an "exception" to Windows, such as "Exception in thread" main "java.lang.OutOfMemoryError: Java heap space".
  • This method can also be used for Windows 8.
  • This is a "temporary" memory that is available for Java applications when you run them. No standard memory is "stolen" or withdrawn from computer memory. It is only a guarantee for the Java Virtual Machine.
  • The value you cherish depends on the amount of memory in your computer, and how much memory all running processes consume.
  • There is no need to restart the computer after adjusting the Java memory.
  • This method can also be used in Windows XP with some modification.