Closed hMsats closed 1 year ago
Memory fragmentation. glibc's malloc allocator fragments memory and fulcrum does many allocations and free's in many threads. See if you can link it to use jemalloc
. Maybe install jemalloc
and recompile. It will help.
If, after you compile and link to jemalloc
, and Fulcrum shows it found jemalloc
at runtime, and you are still unsatisfied with the memory consumption, then you can tell jemalloc
to behave itself and not waste memory by having the following environment variable set:
MALLOC_CONF=tcache:false
Note that the above comes with a small performance penalty but it forces jemalloc
to clean up after itself in per-thread allocations.
Thanks for the fast reply! I will try that but not today because today I'm very busy. Will report back soon.
Found some time today. Installed jemalloc
and compiled Fulcrum with make clean; qmake LIBS+=-ljemalloc; make -j4
and it seems to work! Fulcum outputs it was using [2023-08-02 10:51:19.164] jemalloc: version 5.3.0-113-g62648c8
.
19.9% is much better than 41%:
user 1108261 20.3 27.6 7405000 2215504 ? SLl jul14 5464:15 ./bitcoind -datadir=/media/ssd/.bitcoin/
user 3076974 11.1 19.9 3511792 1600088 ? Tl 10:51 15:14 /home/user/Fulcrum/Fulcrum /home/user/Fulcrum/config.conf
and it doesn't seem to increase. Thanks a lot. Genius!
BTW in Fulcrum.pro jemalloc is written as jemaloc in a comment:
I'll keep an eye on the memory usage but for now closing this issue.
Glad it all worked out. Yeah in my experience consumption remains stable.
You may find it will be even lower with that env var I talked about above but the jemalloc docs say then allocations will use a process-wide lock which may mean parallelism is sacrificed to some degree.
Yeah in my experience consumption remains stable.
After running Fulcrum for more than 5 days, I can confirm that memory usage is stable and much lower now.
Yay! And the Fulcrum admins of the world rejoice!
Still a HUGE Fulcrum fan!
I run Fulcrum with Bitcoin Core on a server with 8GB of RAM. I gave 2500MB to bitcoind, so that should be about 31% of the total memory which corresponds well with the 27.3% shown below:
I gave 1GB of RAM to Fulcrum. I know that Fulcrum can take a bit more memory but the 41% shown above corresponds to 3.3GB of RAM. It's not a problem for my server but I don't understand it.
Do you have some explanation? Thanks in advance.
Extra info:
Ubuntu 20.04.6 LTS
Restarted Fulcrum yesterday, so it hasn't been running for a very long time.
Latest release:
Fulcrum 1.9.1 (Release d628948)
db_max_open_files = 20
db_mem = 1000.0
(memory usage was about the same without db_mem set in config.conf)