Large string processing + concurrency + caching/memoization
really brings out the worst in glibc malloc :<
Bursts of small object allocations late in process life contribute to
fragmentation of the heap due to arenas (slabs) used internally by Perl.
-jemalloc (tested as an LD_PRELOAD on GNU/Linux) appears to reduce
+jemalloc (tested as an LD_PRELOAD on GNU/Linux) reduces
overall fragmentation compared to glibc malloc in long-lived processes.
+glibc malloc users may try setting C<MALLOC_MMAP_THRESHOLD_> to a lower
+value (e.g. 131072) but that may require increasing the
+C<sys.vm.max_map_count> sysctl.
=head2 Other OS tuning knobs
After = public-inbox-netd.socket
[Service]
-# An LD_PRELOAD for libjemalloc can be added here. It currently seems
+# An LD_PRELOAD for libjemalloc can be added here. It is
# more resistant to fragmentation in long-lived daemons than glibc.
+# If you're unable to use jemalloc, setting MALLOC_MMAP_THRESHOLD_
+# to a lower value (e.g. 131072) but that may also require increasing
+# the sys.vm.max_map_count sysctl.
Environment = PI_CONFIG=/home/pi/.public-inbox/config \
PATH=/usr/local/bin:/usr/bin:/bin \
TZ=UTC \