Reputation: 54796
I followed this answer in order to increase the amount of memory that is allocated to the JVM on a system-wide basis. It seems to work as advertised as far as getting the setting to the Java process.
However, the Java process that I want to increase the memory allocation for is actually being spawned by an opaque third-party process that specifies its own memory options when it creates the Java process (and which provides no configuration of the options that it passes, hence the need for the system-wide setting).
So what happens is that both settings get passed to the Java process. Or at least, that's what appears to happen when I use the approach described here to view the JVM arguments. I get something like:
Is there some precedence order that dictates which setting is used when the same option is specified multiple times (and that guarantees that the same setting will always be selected)?
Or is there some other way to check to see which settings are actually being applied?
Upvotes: 1
Views: 2587
Reputation: 240860
to check you can do this
-Xms128m
-Xmx256m
-Xmx2g
and then
// allocate 256m
byte[] array = new byte[ 256 * 1024 * 1024 ];
System.out.println(runtime.totalMemory());
if its first option that gets picked up it will OOM, otherwise it will proceed and it will show you total memory as > 256m
Upvotes: 2