Re: [PATCH] search for modern malloc implementation

From: Henrik Nordström <henrik_at_henriknordstrom.net>
Date: Sat, 29 May 2010 10:47:49 +0200

lör 2010-05-29 klockan 18:58 +1200 skrev Amos Jeffries:
> +CXXFLAGS="$CXXFLAGS -nostdlib"
> +AC_SEARCH_LIBS([malloc],[tcmalloc jemalloc dlmalloc ptmalloc3
> nedmalloc ptmalloc2 malloc])
> +CXXFLAGS=$saved_flags

I am not very comfortable with this. -nostdlib is a GCC option, and also
there is no guarantee that linking a malloc library will at all work
with that option. It only works by accident when using shared libraries
due to the shared libraries having embedded dependencies and brings in
libc as well.

Also as mentioned before the mallopt and mallinfo calls need to be
appropriately shielded to disable them if the selected malloc do not
implement them. Unfortunately that has to be handcoded as autoconf can
not test if the function comes from a selected lib or libc. Thankfully
both are relatively harmless if called but mallinfo data given in
cachemgr will be odd if not implemented by the actually used malloc.

Regards
Henrik
Received on Sat May 29 2010 - 08:47:54 MDT

This archive was generated by hypermail 2.2.0 : Sat May 29 2010 - 12:00:12 MDT