A few tiny patches to enable using libumem with
LD_PRELOAD on Linux.
1) For AMD64, the UMEM_PTHREAD_MUTEX_TOO_BIG macro
needs to be defined. Most likely this should just be
made dependent on __LP64, or a real autoconf test
should be written to check it.
2) For use with LD_PRELOAD, the malloc replacements
must be present, and you must arrange for umem_startup
to be called at load time. I added a umem_do_startup
constructor for this purpose.
3) Recursive calls into malloc at library
initialization time are really hairy. The call to
sysconf() to get the number of CPUs winds up calling
fopen() which of course calls malloc, so I wrote a
quick hack to read /proc/cpuinfo for this information.
There are many other recursions of this type that can
be triggered when libumem is preloaded into various
programs. I only fixed this one because it's enough to
get my target program running.
Log in to post a comment.