How can I increase the JVM memory? [duplicate]
HI, I like to know can I increase the memory of the JVM depending on my application.If yes how can I increase the JVM memory? And how can I know the size of JVM?
Solution 1:
When starting the JVM, two parameters can be adjusted to suit your memory needs :
-Xms<size>
specifies the initial Java heap size and
-Xmx<size>
the maximum Java heap size.
http://www.rgagnon.com/javadetails/java-0131.html
Solution 2:
If you are using Eclipse then you can do this by specifying the required size for the particular application in its Run Configuration's VM Arguments as EX: -Xms128m -Xmx512m
Or if you want all applications running from your eclipse to have the same specified size then you can specify this in the eclipse.ini
file which is present in your Eclipse home directory.
To get the size of the JVM during Runtime you can use Runtime.totalMemory()
which returns the total amount of memory in the Java virtual machine, measured in bytes.