Yoshinori Nishino wrote:
> Dear Howard-san,
> 
>> There is no issue with thread-safety for ber_strdup. What exact line of 
>> memory.c are you talking about?
> 
> I think ber_strdup(), which uses ber_memalloc_x(), is non thread-safe because 
> of the following comment at around line 69 of memory.c:
> 
> /* Note sequence and ber_int_meminuse are counters, but are not
>   * thread safe.  If you want to use these values for multithreaded 
> applications,
>   * you must put mutexes around them, otherwise they will have incorrect 
> values.
>   * When debugging, if you sort the debug output, the sequence number will
>   * put allocations/frees together.  It is then a simple matter to write a 
> script
>   * to find any allocations that don't have a buffer free function.
>   */

That comment only applies when using LDAP_MEMORY_DEBUG and is irrelevant.

-- 
   -- Howard Chu
   CTO, Symas Corp.           http://www.symas.com
   Director, Highland Sun     http://highlandsun.com/hyc/
   Chief Architect, OpenLDAP  http://www.openldap.org/project/



Reply via email to