Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

64-bit java won't allocate more than 2GB of heap memory

I'm running my program from eclipse and using 64-bit java, but I still can't get it to allocate more than 2GB of memory. I'm running some benchmarks so I need a lot of memory.

I have this in my eclipse.ini: -Xmx8g

I want it to use all my memory. Could this be due to a 32-bit version of eclipse? I'm not sure what I have for eclipse.

I've tried sending in -Xmx8g to VMArgs when running the program. I'm running 64-bit windows 7 and a 64-bit JRE.

like image 958
Justin Avatar asked Apr 03 '13 22:04

Justin


People also ask

What is the maximum heap size for 64 bit JVM?

For 64 bit platforms and Java stacks in general, the recommended Maximum Heap range for WebSphere Application Server, would be between (4096M - 8192M) or (4G - 8G).

What is the max Java heap size that can be allocated?

The theoretical limit is 2^64 bytes, which is 16 exabytes (1 exabyte = 1024 petabytes, 1 petabyte = 1024 terabytes). However, most OS's can't handle that. For instance, Linux can only support 64 terabytes of data. Note: We don't recommend you exceed 2 GB of in use JVM heap.

How do I set the amount of heap memory allocated to a process to 2gb?

The short answer Use -Xmx to specify the maximum heap size. Use -Xms to specify the initial Java heap size. Use -Xss to set the Java thread stack size.


1 Answers

In the run configuration screen, go to Arguments tab, add -Xmx8g to the VM arguments text box.

like image 122
Pradeep Pati Avatar answered Sep 18 '22 10:09

Pradeep Pati