views:

476

answers:

3

IBM JRE 5.0 on Windows, when given -Xmx1536m on a laptop with 2GB memory, refuses to start up: error message below. With -Xmx1000m it does start.

Also, it starts fine with -Xmx1536m on other servers and even laptops, so I think that there is something more than just inadequate memory.

Also, when started from within Eclipse (albeit, using the JRE in the IBM 5 JDK in this case) with the same memory parameter, it runs fine.

Any idea what is going on here?

JVMJ9VM015W Initialization error for library j9gc23(2): Failed to instantiate heap. 1536M requested Could not create the Java virtual machine


Edit:

Does anyone know about the "3GB switch" and if it is relevant here (beyond the obvious fact that approximately that this is a memory limitations problem). How can I tell if it is enabled and what is the most straightforward way to turnit on?

+1  A: 

The JVM requires that it be able to allocate its memory as a single contiguous block. If you are on a 32-bit system, the maximum available is about 1280M more or less. To get more you must run a 64-bit JVM on a 64-bit OS.

You may be able to get a little more by starting the JVM immediately after rebooting.

As to starting OK on other systems, are those 32 or 64-bit?

Jim Garrison
The 1280M does seem like the limit here.It works on other 32 bit systems (including the same laptop, when run from Eclipse).
Joshua Fox
There is a hard limit somewhere around 1536M depending on what you have in memory, having to do with the way the address space is set up by Windows and where DLLs are loaded in memory. It can be different on different systems. 1280M is an empirical number that's worked for me. To reliably get much more than 1280 you will need to upgrade to a 64-bit system and JVM. Also remember that Eclipse won't be available in a 64-bit compatible version until Helios (the next release).
Jim Garrison
How do you know Eclipse is getting 1536M?
Jim Garrison
+1  A: 

According to IBM DeveloperWorks:

Cause
The system does not have the necessary resources to satisfy the maximum default heap value required to run the JVM.

To resolve, here is what it says

Resolving the problem
If you receive this error message when starting the JVM, free memory by stopping other applications that might be consuming system resources.

Your JVM doesn't have enough memory resources to create maximum amount of heap space of 1536 MB. Just make sure that you have enough memory to accommodate it.

Also, I believe that in Windows, the maximum heap space is 1000MB? I'm not sure if that's solid, but in Linux/AIX, any Xmx more than 1GB works fine.

The Elite Gentleman
The Elite Gentleman
It is not related to stopping other applications. There is indeed an unfortunately low limit in Windows32. I wonder, though, why the problem is occuring here. Could the "3GB switch" be relevant?
Joshua Fox
By stopping other applications, I meant stopping any applications that ran on the JVM. Heap Space are shared space. I think you should check what Chris Kaminski said because it seems related to your 3GB switch.
The Elite Gentleman
+1  A: 

Pretty much the maximum you are guaranteed to get on a Windows platform is 1450 MB. Sometimes Windows/Java.exe maps DLLS to addresses in the 1.5-2.0GB range. This doesn't change even if you use the /3GB trick (or you have an OS that supports it). You have to manually rebase the DLLs to get them higher towards the 2GB (or 3GB boundary). It's a real pain in the ass, and I've done it before, but the best I've ever been able to get with and without a combination of /3GB is 1.8G on 32bit Windows.

Best to be done with it and migrate to a 64-bit OS. They're prevalent now-a-days.

Chris Kaminski
"1.8G on 32bit Windows"Yes, these other machines do get the 1536M, which is of course else than 1.8G. I wonder why my machine can't get the 1536M.
Joshua Fox
Run processExplorer on your JVM. It will probably show a DLL somewhere near the 1.5GB boundary that is preventing you from getting one single contiguous 1.5GB memory chunk. You could then rebase that DLL higher in the heap.
Chris Kaminski