From: Enter The on
I am using a computer with 6.0g ram, on Windows Vista Business 64-bit.

In Netbeans, I have set my VM Options to -Xmx1g. It works.
If I set the vm options to -Xmx2g it does not work. I get this error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

Why does this happen when I have 6 gigs of ram? I frequently run
System.gc() to reduce the memory used. I have tried turning off the
vista Superfetch to reduce memory usage, but that has not helped. I
currently have 3gb free (shown by task manager) but it won't start).

my java version is

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
From: Mike Schilling on
Enter The wrote:
> I am using a computer with 6.0g ram, on Windows Vista Business 64-bit.
>
> In Netbeans, I have set my VM Options to -Xmx1g. It works.
> If I set the vm options to -Xmx2g it does not work. I get this error:
>
> Error occurred during initialization of VM
> Could not reserve enough space for object heap
> Could not create the Java virtual machine.
>
> Why does this happen when I have 6 gigs of ram? I frequently run
> System.gc() to reduce the memory used. I have tried turning off the
> vista Superfetch to reduce memory usage, but that has not helped. I
> currently have 3gb free (shown by task manager) but it won't start).
>
> my java version is
>
> Error occurred during initialization of VM
> Could not reserve enough space for object heap
> Could not create the Java virtual machine.

Is Netbeans using a 64-bit JDK? It's quite possible )though I don't know
for sure) that a 32-bit JDK can't manage 2GB of heap.


From: Enter The on
That seems to work. Thanks Mike!
From: Lew on
Enter The wrote:
> I frequently run System.gc() to reduce the memory used.

Use of System.gc() is an antipattern most of the time, the more so if you use
it frequently. It also has nothing whatsoever to do with the JVM's ability to
allocate memory from the OS. Your error message:
> Error occurred during initialization of VM
> Could not reserve enough space for object heap
> Could not create the Java virtual machine.
proves that there never even was an opportunity to invoke System.gc(), even
were it to do some good, which it wouldn't.

Mike is correct that a 32-bit JVM is limited to somewhat less than 2 GB heap,
the exact limit depending on the OS. It's also necessary that the JVM
allocate contiguous memory, AIUI. OSes sometimes fragment allocations.

The amount of RAM that the OS shows the JVM to use is only tangentially
related to the amount of free heap controlled by the JVM within itself.

--
Lew
From: Mike Schilling on

"Lew" <noone(a)lewscanon.com> wrote in message
news:hlph7c$e57$1(a)news.albasani.net...
..
>
> Mike is correct that a 32-bit JVM is limited to somewhat less than 2 GB
> heap, the exact limit depending on the OS. It's also necessary that the
> JVM allocate contiguous memory, AIUI.

I don't know why that would be,. A non-contiguous heap can be modeled
simply as a contiguous heap with allocations already taken out of its
middle. I'm not saying you're wrong, just that it's an odd requirement.


 |  Next  |  Last
Pages: 1 2
Prev: J2ME Development on Linux
Next: Java app installer