After thinking for a long time of a generic way to pose this question (and failing to find one) I\'m just going to ask it as a concrete example:
Suppose I have a Lin
Suppose I have a Linux machine which has 1 Gb of memory which it can allocate to processes (physical and swap totals 1 Gb).
My first response would be, unless you are talking about a phone, I would get more memory. You can buy 16 GB (b = bit, B = byte) for less than $100.
does the JVM fail to start right away because it will try to allocate all of the 512 Mb of memory and fail (due to the fact that there's not enough available memory at the moment)?
This can happen if your system does not have 512 MB (plus some overhead) as it allocates the continuous virtual memory used for the heap on startup.
Even if you have 550 MB free, the program could fail to start as it need to load more than just the heap.
will the Java process fail with an OutOfMemoryError?
This can happen if your program uses 512 MB while running, regardless of the amount of memory your machine has. This error will only occur after your JVM has started. You won't get this error if it cannot start.
will it fail with some other (standard) error?
This is possible if you run out of swap space after the program has started. It is rare and only happens on a severely overloaded machine. What I have seen is the JVM crashes due to a low level OS failure to allocate memory.
Java 6 Update 25 VM crash: insufficient memory