1 |
The Blender project found some fairly remarkable discrepancies between |
2 |
what their software actually used and what glibc's ptmalloc allocated: |
3 |
|
4 |
http://www.sintel.org/development/memory-jemalloc/ |
5 |
|
6 |
Results such as these led Blender and others (e.g. Chrome/Chromium, |
7 |
Firefox, Thunderbird) to bundle private versions of jemalloc. This |
8 |
bundling situation violates our policy against bundled libraries. The |
9 |
maintainers could just patch their software to link to libjemalloc. |
10 |
However, it might make more sense to evaluate jemalloc as a |
11 |
distribution-wide replacement for glibc's ptmalloc. |
12 |
|
13 |
It appears that run the following commands on amd64 to see how jemalloc |
14 |
works when used system-wide: |
15 |
|
16 |
echo dev-libs/jemalloc ~amd64 >> /etc/portage/package.accept_keywords |
17 |
emerge dev-libs/jemalloc |
18 |
echo /usr/lib64/libjemalloc.so.1 >> /etc/ld.so.preload |
19 |
|
20 |
I did this on my system, verified that jemalloc was being loaded with |
21 |
strace and rebooted. So far, sudo is broken and anything that is 32-bit |
22 |
will have the loader print an error about the library not being |
23 |
preloaded. On a related note, setuid binaries will obey |
24 |
/etc/ld.so.preload, even though they ignore LD_PRELOAD. |
25 |
|
26 |
There is a chance that patching jemalloc directly into glibc would solve |
27 |
the sudo issue, but I imagine that sudo is doing something strange, |
28 |
which likely merits attention. For now, I am using su as a substitute |
29 |
until I look into why sudo is broken. |
30 |
|
31 |
Unless a significant issue is found in jemalloc itself, I do not see any |
32 |
reason to continue using glibc's ptmalloc over jemalloc. As far as I |
33 |
know, FreeBSD, NetBSD, Facebook and others are using jemalloc, so I |
34 |
expect that no significant issues will be found. jemalloc will still |
35 |
needs testing before we can consider it. Doing good tests is hard, so I |
36 |
would like to crowd source ideas on the appropriate way to test a malloc |
37 |
implementation from the list. My expectation is that people on the list |
38 |
will collectively think of better ideas than I could on my own. |
39 |
|
40 |
With that said, what do people think? |