4

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.

user2479100
  • 105
  • 1
  • 2
  • 7

4 Answers4

4

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.

Community
  • 1
  • 1
selig
  • 4,834
  • 1
  • 20
  • 37
0

If you are using 64 bit os than the real solution is adding -d64 to force it to run in 64 bits and therefore allocate the 4GBs.

umangm
  • 39
  • 3
0

i would definitely suggest you to go thru article

http://javarevisited.blogspot.in/2013/04/what-is-maximum-heap-size-for-32-bit-64-JVM-Java-memory.html

Apart from Ram, xmx paramters also depends on parameters like os,jvm bit etc.

Also would suggest you to ahve statistics to determine how much free memory is there. See http://viralpatel.net/blogs/getting-jvm-heap-size-used-memory-total-memory-using-java-runtime/ to determine how much meory is in use and free memory.

To have best utilization it should be both i.e 64 bit os and 64 bit bit vm

On 32-bit editions of Windows, applications have 4 gigabyte (GB) of virtual address space available. The virtual address space is divided so that 2-GB is available to the application and the other 2-GB is available only to the system.See http://msdn.microsoft.com/en-us/library/Aa366521

so make sure you have enough memory(whatever you are mentioning against params xms and xmx) with the program i mentioned above

M Sach
  • 33,416
  • 76
  • 221
  • 314
0

IMHO it's about the same problem with slight difference in question..

Eclipse memory allocation problem

As you can see Java Runtime Environment are set in Java Control Panel. Try to add Runtime parameter e.g -Xmx3072m in Runtime Parameter's column.

Or perhaps you could check this article out..

How to Increase Java Memory in Windows 7

Hope it's help solving the problem...

Regards, Ivan

Community
  • 1
  • 1
Ivan Herlambang
  • 368
  • 2
  • 8