How to increase memory size for JVM beyond 1gb

19,967

A 32-bit JVM can have a maximum heap size of at most 4GB - in some systems it's less due to various technical reasons (such as the need for contiguous memory). Try using a 64-bit version, assuming you're on a 64-bit machine.

The reason for this is that the maximum number of addresses that you can point to with 32 bits is 2^32, which is 4GB. This theoretical maximum can never really be accessed by the user as it is needed by the JVM for Klass files (the internal representation of your code) and other stuff.

Also see this question.

Share:
19,967
user2479100
Author by

user2479100

Updated on June 11, 2022

Comments

  • user2479100
    user2479100 almost 2 years

    When I try to set -Xms and -Xmx values more than 1gb, I am getting an error:

    Error occurred during initialization of VM

    My pc has 8GB of RAM.

    I need to hold and manipulate a huge amount of data in memory.