Difference between revisions of "Reducing memory usage"

From Bisq Wiki
Jump to navigation Jump to search
 
(17 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Default MaxRAM Setting ==
+
Bisq is known to be a resource-hungry application, so some users may want to '''reduce memory usage'''.
  
One of the settings java virtual machines use to calibrate how much physical memory to reserve at startup is '''MaxRAM''', and there is a good chance your JVM thinks it has more RAM to use than is installed on your machine.  To check the default MaxRAM setting, run this java 'version' command: 
+
__TOC__
  
    java -XX:+UnlockDiagnosticVMOptions -XX:+PrintFlagsFinal -version | grep MaxRAM
+
{{Run_with_Java_options|<nowiki>-XX:MaxRAM=4g</nowiki>|Reduce Bisq's memory usage by setting a ceiling of 4GB}}
  
Look for the default MaxRAM setting in the output;  this machine says
+
== Persistent setting and Windows work-around ==
  
    367: uint64_t MaxRAM                                  = 137438953472                          {pd product} {default}
+
If you'd rather not specify the RAM parameter every time you start Bisq, you can specify it in <code>Bisq.cfg</code> so it automatically takes effect every time.
  
meaning my OpenJDK 11 JVM's MaxRAM setting is 128 GB, on a machine with only 16 GB RAM.
+
First, make sure Bisq is closed.
  
Experiments have shown starting Bisq with a 4g (GB) MaxRAM setting reduces resident memory consumption by more than 50% when starting a clean Bisq installation -- with an empty data directory.
+
Your <code>Bisq.cfg</code> file is in the directory with your Bisq binary (this is different from your [[Data_directory|data directory location]]). See [[Running from the command line|locations for each OS here]].
  
Setting MaxRAM to 2g reduces resident memory usage even more, but setting it any lower (1536m) will result in an OutOfMemoryError and crash the app.
+
Navigate to the directory with your Bisq binary. Using Windows as an example, this would be <code>$home\AppData\Roaming\Bisq\</code>.
  
As of version 1.2.7, Bisq starts up with a MaxRAM setting of 4g (GB)If you are using Bisq v1.2.6 or older, consider upgrading to the latest version to reduce Bisq's RAM usage.
+
<code>Bisq.cfg</code> should be in the <code>app</code> directory.
 +
 
 +
Open that file in a text editor. Look for the <code>[JavaOptions]</code> section, and a line in that section that look something like <code>java-options=-XX:MaxRAM=8g</code>. Change it to <code>java-options=-XX:MaxRAM=4g</code>, or add it if it's not already there.
 +
 
 +
[JavaOptions]
 +
  java-options=-XX:MaxRAM=4g
 +
 
 +
You can also try disabling the hardware graphics acceleration by adding the following line at the end of the <code>Bisq.cfg</code>
 +
 
 +
[JVMOptions]
 +
-Dprism.order=sw
 +
 
 +
Save the file, close it, and then open Bisq.

Latest revision as of 23:21, 21 August 2021

Bisq is known to be a resource-hungry application, so some users may want to reduce memory usage.

Command-line fix

Reduce Bisq's memory usage by setting a ceiling of 4GB:

JAVA_TOOL_OPTIONS="-XX:MaxRAM=4g" /opt/bisq/bin/Bisq

/opt/bisq/bin/Bisq is the default application directory on Linux. If you run another operating system, you'll need to replace that path with the one for your OS.

You can adjust the scaling factor as you wish, of course, and add any runtime options for Bisq as well.

GUI fix

To be able to launch the fix by double clicking an icon, rather than running a command in CLI, you can edit the launcher file to run, instead of the Bisq app directly, a shell script which injects said fix.

1. Create a text file (for example /opt/bisq/Bisq-runner.sh) containing the following code:

#!/bin/bash
JAVA_TOOL_OPTIONS="-XX:MaxRAM=4g" /opt/bisq/bin/Bisq

2. Make it executable:

chmod +x /opt/bisq/Bisq-runner.sh

3. Edit the launcher file (/opt/bisq/Bisq.desktop and/or /usr/share/applications/Bisq.desktop) by opening it in a text editor and modifying the Exec line like follows:

Exec=/opt/bisq/Bisq-runner.sh

Persistent setting and Windows work-around

If you'd rather not specify the RAM parameter every time you start Bisq, you can specify it in Bisq.cfg so it automatically takes effect every time.

First, make sure Bisq is closed.

Your Bisq.cfg file is in the directory with your Bisq binary (this is different from your data directory location). See locations for each OS here.

Navigate to the directory with your Bisq binary. Using Windows as an example, this would be $home\AppData\Roaming\Bisq\.

Bisq.cfg should be in the app directory.

Open that file in a text editor. Look for the [JavaOptions] section, and a line in that section that look something like java-options=-XX:MaxRAM=8g. Change it to java-options=-XX:MaxRAM=4g, or add it if it's not already there.

[JavaOptions]
java-options=-XX:MaxRAM=4g

You can also try disabling the hardware graphics acceleration by adding the following line at the end of the Bisq.cfg

[JVMOptions]
-Dprism.order=sw

Save the file, close it, and then open Bisq.