blob: bdcbc097e2e605fba795f5d0d622884f079cf5ec (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
This is drop-in replacement for the standard libc malloc/realloc/free routines.
In many cases it makes a sense to use it with your program instead of the
standard ones, as sometimes it is significantly more efficient and fast,
especially for the memory intensive apps such as virtual machines, GUIs etc.
There are two methods of linking it with your program:
1) Run-time linking using LD_PRELOAD.
This method doesn't requre to recompile a program, but doesn't work for
statically linked binaries. Just set the following environment variable and
run your program - dynamic linker will automatically do the rest:
LD_PRELOAD=%%PREFIX%%/lib/dlmalloc_module.so
2) Compile-time linking.
Compile your applications that use the dlmalloc port with the following
command line options:
-I%%PREFIX%%/include/dlmalloc -L%%PREFIX%%/lib -ldlmalloc
Note that the include (-I<path>) directive shown here should appear before
any other include directive that would cause the compiler to find the FreeBSD
file malloc.h. Using the FreeBSD malloc.h instead of the dlmalloc malloc.h
will result in an app that fails in many odd and maybe spectacular ways.
It makes a sense to use the first method to benchmark effect of using this
version of memory management routines and if positive effect is confirmed then
recompile the application using the second method.
|