Skip to content

Memory and our software

Justin Bowen edited this page Jul 12, 2021 · 11 revisions

Many people have had issues over the years I've been a staff member on these projects that are related to the default memory settings. To help us with these issues, I've outlined some things one can do in order to alleviate this, and also find out what is the maximum you can set your memory to.

Know what your JVM can do

First up is a wonderful command that will tell you the maximum amount of RAM you can set for Java's JVM...
Any OS with 'awk' (ie Linux, Unix, or Windows with UnxUtils installed and on the PATH environment variable):
java -XX:+PrintFlagsFinal 2>&1 | grep MaxHeapSize | awk '{printf "%.2f GB\n",$4/1024/1024/1024}'
The above command will print it out in GB. If you want the MB value that you can assign in the various shell scripts and ini files use this version:
java -XX:+PrintFlagsFinal 2>&1 | grep MaxHeapSize | awk '{printf "%.2f MB\n",$4/1024/1024}'
For OS without 'awk':
java -XX:+PrintFlagsFinal 2>&1 | grep MaxHeapSize
In order to get meaningful values from the above command, you must divide the output yourself. To get the answer in GB, divide by 1073741824. For example: 4294967296÷1073741824 is 4GB. To get the answer in usable MB... divide instead by 1048576. For example: 4294967296÷1048576 is 4096MB.

Setting the appropriate memory values

Next, you'll want to set the appropriate .l4j.ini file, .sh script, or what have you to the MB value from above, or less. Remember that you'll need to save some RAM for the OS as well. So, if the command tells you that you can do 1024MB and you only have 1GB of RAM, you should probably be using a setting of 512 or 768.

Ask for help!

People are more than willing to offer suggestions on the forums. Just ask! We can't help if we don't know you're having an issue.

Bug Reports

If you have an issue because your JVM doesn't support the RAM settings that are default, please don't report it as a bug. This is not a bug, but rather a user configuration change needed.

Clone this wiki locally