This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

glibc malloc hook deprecation considered harmful


Hi all,

I see that malloc hooks have been deprecated and are scheduled for removal:

http://sourceware.org/ml/libc-alpha/2011-05/msg00103.html

Unless there is a better replacement in the offing, I would like to
argue that they remain.

The claim has been made that these hooks do not work in the presence
of threads. I agree that it is unsafe for a program to change these on
the fly.

However, as far as I am aware, they are the only safe / reliable means
of intercepting malloc for an entire program, at least on Linux
platforms.

Invoking them at startup (via init_hook) works well. Hoard relies on
it (www.hoard.org), and it works just fine for massively multithreaded
programs used in a large variety of industrial settings (British
Telecom, Credit Suisse, Reuters, to cite just a few). In addition to
Hoard and DieHard (www.diehard-software.org), I am sure there are
other allocators that rely on malloc hooks.

Without malloc hooks, there is no way to be certain that all
allocation functions have been intercepted. Authors of malloc
implementations otherwise have to play catch-up with every new version
of glibc to (hopefully) intercept all functions that accessed malloc
internally (via __libc_malloc or somesuch). The hooks work well --
please keep them or provide a suitable replacement.

Best,
-- Emery Berger

--
Professor Emery Berger
Department of Computer Science
University of Massachusetts, Amherst
www.cs.umass.edu/~emery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]