-
Notifications
You must be signed in to change notification settings - Fork 288
Memory and our software
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.
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.
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.
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.
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.