Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

about increasing heap size of JVM

Tags:

java

jvm

i have developed chatting application using threads. but when i start my application system acts very slow and sometime exception occur that heap is full. i want to increase heap size of Java Virtual Machine. how can i do it?

like image 844
Vinay Avatar asked Dec 21 '22 00:12

Vinay


1 Answers

Just increase the heap size of the JVM. All Java applications, even simple ones, consume a lot of memory. Take a look at this article explaining in detail how to increase the amount of memory available for your application; basically you'll need to pass a couple of extra parameters to the JVM when you invoke the java command, like this:

java -Xms64m -Xmx256m HelloWorld

In the above command, I'm saying that the HelloWorld program should have an initial heap size of 64MB and a maximum of 256MB. Try with these values and fiddle a bit with them until you find a combination of values that works for your application.

like image 114
Óscar López Avatar answered Jan 02 '23 00:01

Óscar López