diff options
author | Benjamin Neff <benjamin@coding4coffee.ch> | 2018-11-01 21:53:56 +0300 |
---|---|---|
committer | Benjamin Neff <benjamin@coding4coffee.ch> | 2018-11-04 05:04:39 +0300 |
commit | b2712ebf1d28df977d7a9b33cf2f802dd907535e (patch) | |
tree | a58f71ea5476523ec1ae4229a1d8d4d415eecf2e /script | |
parent | 470efd4ec56e0dc251258fd42eb1d02886f919fd (diff) |
Use libjemalloc if it's available for better memory usage
Fixes #6763
closes #7919
Diffstat (limited to 'script')
-rwxr-xr-x | script/server | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/script/server b/script/server index eb8b92294..9cc8ee51a 100755 --- a/script/server +++ b/script/server @@ -202,6 +202,21 @@ diaspora.yml.example " 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 printf "Starting Diaspora in $RAILS_ENV mode " if [ -n "$PORT" ] |