Skip to content

Commit

Permalink
init: add MALLOC_ARENA_MAX=1 to systemd
Browse files Browse the repository at this point in the history
This adds the `MALLOC_ARENA_MAX=1` environment variable as suggested in
https://github.com/bitcoin/bitcoin/blob/master/doc/reduce-memory.md#linux-specific
to the systemd service file definition.

Without this env var, memory usage can grow significantly especially when
`rpcthreads` is increased above its default value.

Closes bitcoin#24542.
  • Loading branch information
sangaman committed May 12, 2023
1 parent 9d85c03 commit 0cd0eec
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contrib/init/bitcoind.service
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ ExecStart=/usr/bin/bitcoind -daemonwait \
-conf=/etc/bitcoin/bitcoin.conf \
-datadir=/var/lib/bitcoind

# Avoid excessive memory usage by bitcoind
Environment="MALLOC_ARENA_MAX=1"

# Make sure the config directory is readable by the service user
PermissionsStartOnly=true
ExecStartPre=/bin/chgrp bitcoin /etc/bitcoin
Expand Down

0 comments on commit 0cd0eec

Please sign in to comment.