This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I am using Eclipse Helios. I run a heavy java program and got out of memory exception. I increase the heap size to -Xmx2048m by specifying in the eclipse.ini file.
But when i try to run the eclipse, i get error. "couldn't create java virtual machine".
So I am wondering what is the maximum heap size that can be allocated for a java program in any IDE.
I know its an open end questions. but it would be great if you can tell the maximum heap size you have used in java development.
Actually, that's the wrong question. The IDE itself is running in the same VM that the apps in the IDE are running in, so the real question would be "what is the maximum heap size possible to allocate in a VM?
And the answer to that depends on what VM you are running: 32-bit or 64-bit and the available system RAM.
In practical terms, a busy Eclipse IDE machine does need 2-3GB of total system RAM, so it may be time to go hardware shopping.
An IDE is no substitute for an Intelligent Developer.
If you are using a 32-bit JVM, the max heap size is usually around 1.5GB on Windows and around 2GB(not sure on this one) on Linux. The exact amount varies depending on the exact version of the OS (including patch levels), and on other variables such as the amount of permgen space allocated. If you are using a 64-bit JVM, the heap is limited only to the amount of RAM plus swap space that you have.
If your app is really that memory hungry, you should run it in a separate JVM.