<p></p>
<p>There is a glibc setting on Linux that can be used to define a hard limit of the number of arenas -- thread safe memory pools used by malloc() -- that can be created.  The trade off for using this is more thread contention among Bisq's allocating threads versus less memory usage.</p>
<pre><code>export MALLOC_ARENA_MAX=4  
</code></pre>
<p>Using this on my Ubuntu 18 laptop reduces the RES memory by ~300 mb, and VIRT by ~3.7 GB.</p>
<p>In addition, configuring the jvm's starting and max heap size reduces both RES and VIRT by another ~200 mb.</p>
<pre><code>export JAVA_OPTS="-Xms820m -Xmx820m"
</code></pre>
<p>Used together</p>
<pre><code>export MALLOC_ARENA_MAX=4                
export JAVA_OPTS="-Xms820m -Xmx820m"
</code></pre>
<p>RES memory is reduced by ~500 mb, and VIRT memory by ~3.9 GB.</p>
<p>I will test these on VMs next (Arch Linux, Debian, Fedora).</p>
<p>These settings, any of which disable dynamic adjustment of glibc's mmap threshold,  save another 100 mb in RES and VIRT, but I haven't experimented enough to suggest anyone else try them yet.</p>
<pre><code>export MALLOC_MMAP_THRESHOLD_=131072
export MALLOC_TRIM_THRESHOLD_=131072
export MALLOC_TOP_PAD_=131072
export MALLOC_MMAP_MAX_=65536
</code></pre>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/issues/3918#issuecomment-599663014">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNXXNDXZ3J5YLTJJUM3RHZOANANCNFSM4KMC7HZA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNUUULCLIJIN2UXGOZDRHZOANA5CNFSM4KMC7HZKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEO7CDJQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/issues/3918#issuecomment-599663014",
"url": "https://github.com/bisq-network/bisq/issues/3918#issuecomment-599663014",
"name": "View Issue"
},
"description": "View this Issue on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>