javanerd
javanerd

Reputation: 2852

Upper limit for java heap

I am already using -Xmx2G. Can I still go ahead and increase it? Is it dependant of the machine I use

Upvotes: 1

Views: 2567

Answers (2)

dogbane
dogbane

Reputation: 274522

From the Java Tuning White Paper:

4.1.2 Heap Sizing

The maximum heap size of a Java application is limited by three factors: the process data model (32-bit or 64-bit) and the associated operating system limitations, the amount of virtual memory available on the system, and the amount of physical memory available on the system.

The size of the Java heap for a particular application can never exceed or even reach the maximum virtual address space of the process data model. For a 32-bit process model, the maximum virtual address size of the process is typically 4 GB, though some operating systems limit this to 2 GB or 3 GB. The maximum heap size is typically -Xmx3800m (1600m) for 2 GB limits), though the actual limitation is application dependent.

Upvotes: 6

mP.
mP.

Reputation: 18266

Why not experiment by running java with different heap options until it complains. Of course its dependent, if your machine only has 64k then you cant very well expect it to have the same heap capability of a multi gigabyte monster !

Upvotes: 0

Related Questions