You are here: Home / Debian GNU/Linux / System / Software / Install Hoard on Debian

Install Hoard on Debian

by Pierre-Yves Landuré last modified Dec 06, 2017 04:32

Hoard is a memory manager enhancing malloc function for multi-threaded softwares. It is designed to replace transparently the default system malloc.

This howto is tested on :

  • Debian 7.0 Wheezy
  • Ubuntu 13.10 Saucy Salamander

This howto is tested with these versions of Hoard :

  • 3.9
  • 3.10

Installation

Install the needed softwares :

command apt-get install build-essential

Download the software latest version:

command wget 'https://raw.github.com/biapy/howto.biapy.com/master/various/sf-downloader' \
--quiet --no-check-certificate --output-document='/tmp/sf-downloader'
SOURCE="$(command bash '/tmp/sf-downloader' --tgz \
--generic='http://www.hoard.org/download-hoard/' \
'hoard' 'Hoard-VERSION-source.tar.gz')"

Go to the sources folder :

command pushd "${SOURCE}/src"

Detect the system architecture :

ARCH=$(command dpkg --print-architecture)
if [ "${ARCH}" = "i386" ]; then
  ARCH="x86"
elif [ "${ARCH}" = "amd64" ]; then
  ARCH="x86-64"
fi

Compile the software version fitting the system architecture :

command make "linux-gcc-${ARCH}"

Install the software :

command install -c -m 644 'libhoard.so' '/usr/local/lib/libhoard.so'
cd "${SOURCE}/src/include"
command mkdir --parents '/usr/local/include/hoard' \
'/usr/local/include/superblocks' \
'/usr/local/include/util'
command find '.' -mindepth 2 -type f -name '*.h' \
| command sed -e 's|^\./||' \
| command xargs -iFILE install -c -m 644 FILE '/usr/local/include/FILE'

Exit the sources folder :

command popd

Delete the downloaded files :

command rm -r "${SOURCE}"

Usage

Use Hoard to optimize a given software (replace /usr/bin/software by the optimized command):

LD_PRELOAD='/usr/local/lib/libhoard.so' /usr/bin/software

If wished, setup the system to use Hoard as default memory manager (dangerous, reboot needed) :

# command echo 'LD_PRELOAD=/usr/local/lib/libhoard.so' >> '/etc/environment'
# command reboot

Thanks