From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Maciej Stachowiak Newsgroups: gmane.lisp.guile.devel Subject: Re: [pthreads] performance test using fib.scm Date: Wed, 11 Dec 2002 05:48:13 -0800 Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: <20021211054813.B20646@noisehavoc.org> References: <20021210211010.GB355@gmx.de> <20021210210220.A24388@noisehavoc.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1039615176 13579 80.91.224.249 (11 Dec 2002 13:59:36 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Wed, 11 Dec 2002 13:59:36 +0000 (UTC) Cc: Maciej Stachowiak Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18M7Ob-0003WD-00 for ; Wed, 11 Dec 2002 14:59:30 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18M7OY-0000hn-00 for guile-devel@m.gmane.org; Wed, 11 Dec 2002 08:59:26 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18M7OG-0000ez-00 for guile-devel@gnu.org; Wed, 11 Dec 2002 08:59:08 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18M7OE-0000eP-00 for guile-devel@gnu.org; Wed, 11 Dec 2002 08:59:07 -0500 Original-Received: from h-64-105-169-114.snvacaid.covad.net ([64.105.169.114] helo=chaos.noisehavoc.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18M7OD-0000eK-00 for guile-devel@gnu.org; Wed, 11 Dec 2002 08:59:05 -0500 Original-Received: from mjs by chaos.noisehavoc.org with local (Exim 3.22 #1 (Debian)) id 18M7Dh-0005eZ-00; Wed, 11 Dec 2002 05:48:13 -0800 Original-To: Mikael Djurfeldt Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: ; from djurfeldt@nada.kth.se on Wed, Dec 11, 2002 at 08:11:50AM +0100 Original-cc: guile-devel@gnu.org Original-cc: Ulrich Drepper Original-cc: Wolfgang Jaehrling X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:1818 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:1818 On 11Dec2002 08:11AM (+0100), Mikael Djurfeldt wrote: > Maciej Stachowiak writes: > > > On 10Dec2002 10:10PM (+0100), Wolfgang Jaehrling wrote: > >> malloc() in glibc is thread-save, but not reentrant. Since the > >> behaviour of realloc() is unlikely to differ from malloc() in this > >> respect, you most certainly have to protect calls to it with a lock. > >> > > > > Huh? Doesn't malloc do it's own locking when modifying global data > > structures? > > This is what I would have expected. > > Can someone please verify that malloc is reentrant? According to the best info I can find on Google, glibc's malloc can be called safely from multiple threads but cannot necessarily safely be called from a signal handler (another possible definition of re-entrant). A mutex would not help with calling it from a signal handler anyway, though. So don't bother with locking. If you truly suspect heap corruption I suggest running with MALLOC_CHECK_=2 set in your environment. This should detect many kinds of heap corruption. Regards, Maciej _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel