[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: malloc use

At 02:58 PM 2001-09-26, Howard Chu wrote:
>While profiling slapd with FunctionCheck I found a couple places that were
>using libc's malloc calls directly, instead of going thru -lldap/-llber etc.

MOST of slapd goes through ch_malloc() routines as most of slapd
doesn't check for errors.  Those codes which have been updated
to check for errors AND handle them appropriately, should NOT
use ch_malloc() routines.  Likely they should use ber_memalloc()
routines [or SLAP_MALLOC* wrapping macros (not yet written)
if we want a level of indirection for later].

There are some special cases, such as were the memory was
allocated by a library and that library requires use of a
special deallocator.

>This is clearly wrong inside the slapd code (I just commited a patch to at.c
>for this) but the other case is in libavl. I believe this should be fixed
>too, yes? Should it be using ber_memalloc?

Yes, ber_memalloc() routines [or AVL_MALLOC wrapping macros].