Lockless Inc

Linux Installation

Dynamic Library

To install the dynamic version of the Lockless memory allocator, you must first copy it to the correct location in your file system.

This location depends on which Linux distribution you use, and whether or not you use a 64bit machine.

The correct location is:
  • Debian or Ubuntu based systems:
    32bit: /usr/lib
    64bit: /usr/lib
    32bit library in a 64bit multilib install: /usr/lib32

  • Redhat, Suse or Gentoo based systems:
    32bit: /usr/lib
    64bit: /usr/lib64
    32bit library in a 64bit multilib install: /usr/lib32 or /usr/lib depending on if /usr/lib is a symlink to /usr/lib64 or not.
Become root
> su
"root password"

Copy the library to the correct location (here we assume /usr/lib)
> cp libllalloc.so.1.1 /usr/lib

Go to that location (here we assume /usr/lib)
> cd /usr/lib

Make the two symlinks to properly install the library
> ln -sf libllalloc.so.1.1 libllalloc.so
> ln -sf libllalloc.so.1.1 libllalloc.so.1


Regenerate your library cache for the directory you are in (assuming /usr/lib)
> ldconfig -n /usr/lib

Done - all installed
> exit

If you have a volume license, then you have both 64bit and 32bit libraries in your download.  Don't forget that you can install both on 64bit distributions that support multilib.  Just choose the correct lib directories for your Linux distribution and repeat the above twice for the 32bit and 64bit libraries.

Once installed, the Lockless memory allocator can be used in several ways.

  1. Firstly, you can link it to programs you compile.  Just add "-lllalloc" to the link command line to add the library to your program.  You can check that this has worked by running ldd on the compiled program.
    > ldd my_program

    Make sure libllalloc.so is listed as a library in the output from ldd.  If not, check your library search paths in /etc/ld.so.conf to make sure the directory you installed the library in is listed.  Another possible error is that you didn't put "-lllalloc" far enough along in the link command line.  The linker will only add a library to an executable if it will satisfy dependencies for currently unseen external symbols as it scans the command line from left to right.  If the object files that use i.e. malloc() or free() are placed after -lllalloc on the link command line, then the linker won't know that the library is needed.  The easiest way to fix this is to put "-lllalloc" last.

  2. If you wish to have a program use the library, and do not wish to recompile it, you can use the LD_PRELOAD feature of glibc.  Again assuming the library is installed in /usr/lib

    If your shell is bash or ksh you can use:
    > export LD_PRELOAD=/usr/lib/libllalloc.so

    If your shell is csh or tcsh you can use:
    > setenv LD_PRELOAD /usr/lib/libllalloc.so

    This will cause all programs launched from that shell to use the Lockless memory allocator instead of the default one.

  3. If you want all your programs to run using the memory allocator add the above lines to your shell's init file.

    i.e. If your shell is bash, edit your .bashrc in your home directory, and add "export LD_PRELOAD=/usr/lib/libllalloc.so" to it.

Note that it is probably not wise to let root run programs linked with the Lockless memory allocator.  The allocator is designed for speed, not security.

Static Library

To use the static version of the Lockless memory allocator, you may want to first copy it to somewhere where your linker will find it.  Do this if you wish to avoid adding "-L" directory search options to your linker command line.

First determine the correct location for the library in your filesystem.  This location depends on which Linux distribution you use, and whether or not you use a 64bit machine.

The correct location is:
  • Debian or Ubuntu based systems:
    32bit: /usr/lib
    64bit: /usr/lib
    32bit library in a 64bit multilib install: /usr/lib32

  • Redhat, Suse or Gentoo based systems:
    32bit: /usr/lib
    64bit: /usr/lib64
    32bit library in a 64bit multilib install: /usr/lib32 or /usr/lib depending on if /usr/lib is a symlink to /usr/lib64 or not.
Become root
> su
"root password"


Copy the library to the correct location (here we assume /usr/lib)
> cp libllalloc.a /usr/lib

Done - all installed
> exit

If you do this, then linking with "-lllalloc" will include the static library in your executable.  Note, if you have also purchased and installed the dynamic library, then you will also need to include the "-static" compile option to select static linking rather than the dynamic library.

If you do not wish to install the library in the standard location, then you can compile your programs by adding "/some/path/to/library/libllalloc.a" to the end of your link command line.  This method allows you to install the library where ever you wish.

Note that it is probably not wise to let root run programs linked with the Lockless memory allocator.  The allocator is designed for speed, not security.

About Us Returns Policy Privacy Policy Send us Feedback
Company Info | Product Index | Category Index | Help | Terms of Use
Copyright © Lockless Inc All Rights Reserved.