Use libjemalloc if it's available for better memory usage

Fixes #6763

closes #7919
This commit is contained in:
Benjamin Neff 2018-11-01 19:53:56 +01:00
parent 470efd4ec5
commit b2712ebf1d
No known key found for this signature in database
GPG key ID: 971464C3F1A90194
2 changed files with 16 additions and 0 deletions

View file

@ -11,6 +11,7 @@
## Features ## Features
* Add the ability to assign roles in the admin panel [#7868](https://github.com/diaspora/diaspora/pull/7868) * Add the ability to assign roles in the admin panel [#7868](https://github.com/diaspora/diaspora/pull/7868)
* Improve memory usage with libjemalloc if available [#7919](https://github.com/diaspora/diaspora/pull/7919)
# 0.7.7.0 # 0.7.7.0

View file

@ -202,6 +202,21 @@ diaspora.yml.example
" "
fi fi
# Use libjemalloc if it's available for better memory usage
command -v ldconfig > /dev/null 2>&1
if [ $? -eq 0 ]; then
ldconfig=ldconfig
elif [ -x /sbin/ldconfig ]; then
ldconfig=/sbin/ldconfig
fi
if [ -n "${ldconfig}" ]; then
jemalloc_path=$(${ldconfig} -p | grep jemalloc | tr ' ' '\n' | grep '^/' | head -1)
if [ -n "${jemalloc_path}" ]; then
export LD_PRELOAD="${jemalloc_path}"
fi
fi
# Start Diaspora # Start Diaspora
printf "Starting Diaspora in $RAILS_ENV mode " printf "Starting Diaspora in $RAILS_ENV mode "
if [ -n "$PORT" ] if [ -n "$PORT" ]