So I was wondering if there was any way to allow more ram to a program on a Raspberry Pi 3. I have a process which takes 76,7% of the memory (it's a tomcat server) and need another one like this to run, so my Raspberry can't handle it right now.
Is there a way to run a program using something else as ram or convert virtually a part of the sd card in ram (like on Android for instance). Or can we add physically a ram module ? Or can we force a program to take less memory ?
Thank you in advance !
The Raspberry Pi 3 has 1 GB of RAM, so I suppose it should be capable of running two instances, depending on what exactly your server is doing.
Tomcat itself runs on a JVM (Java virtual machine), so you can configure the amount of memory allocated to it. Try setting the JAVA_OPTS
environment variable to adjust maximum memory usage.
Depending on your setup, you should be able to do this in /etc/default/tomcat*
(where * depends on your version of Tomcat) by adding a line such as JAVA_OPTS="-Xmx512m"
. This example would allocate a maximum of 512 MB to Tomcat.
What you are describing about using the SD card as RAM is called swap memory. Your system does this automatically when it runs out of memory, but it is very slow and should be avoided whenever possible.