From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jim Meyering Newsgroups: gmane.emacs.devel Subject: Re: please set both MALLOC_PERTURB_ and MALLOC_CHECK_ envvars Date: Sat, 28 May 2011 22:33:38 +0200 Message-ID: <87k4dasgyl.fsf@rho.meyering.net> References: <874o4fx17z.fsf@rho.meyering.net> <87y61rvmaz.fsf@rho.meyering.net> <87tyceo9we.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1306614827 30639 80.91.229.12 (28 May 2011 20:33:47 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 28 May 2011 20:33:47 +0000 (UTC) Cc: Emacs development discussions To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat May 28 22:33:43 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QQQCc-0003x1-VF for ged-emacs-devel@m.gmane.org; Sat, 28 May 2011 22:33:43 +0200 Original-Received: from localhost ([::1]:45880 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQQCc-0004eE-8X for ged-emacs-devel@m.gmane.org; Sat, 28 May 2011 16:33:42 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:36103) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQQCa-0004e7-2g for emacs-devel@gnu.org; Sat, 28 May 2011 16:33:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QQQCZ-0002mn-91 for emacs-devel@gnu.org; Sat, 28 May 2011 16:33:40 -0400 Original-Received: from mx.meyering.net ([82.230.74.64]:34248) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QQQCY-0002mi-V6 for emacs-devel@gnu.org; Sat, 28 May 2011 16:33:39 -0400 Original-Received: by rho.meyering.net (Acme Bit-Twister, from userid 1000) id 43156602F2; Sat, 28 May 2011 22:33:38 +0200 (CEST) In-Reply-To: <87tyceo9we.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 28 May 2011 16:19:45 -0400") Original-Lines: 45 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 82.230.74.64 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:139853 Archived-At: Chong Yidong wrote: > Jim Meyering writes: > >>> If you develop emacs, or even if you just build from sources regularly, >>> on a glibc-based system, do us all a favor and build with these envvar >>> settings: >>> >>> export MALLOC_PERTURB_=$((RANDOM % 255 + 1)) >>> export MALLOC_CHECK_=3 >>> >>> Why? Because that helps you expose malloc-related problems far earlier. >>> I've found numerous bugs that way. >> >> Most of that argument is valid, but I have to confess this time >> a compiler problem appears to be at fault. >> [...] >> gcc version 4.7.0 20110528 (experimental) (GCC) >> >> everything works fine, and yes!, even with these envvar settings: >> >> MALLOC_PERTURB_=117 >> MALLOC_CHECK_=3 >> >> So at least for a little while, I'll be using that. > > Maybe we should add these environment variables to the Hydra build. Good idea. > But > what to use for MALLOC_PERTURB---117, or the value in your previous > message? You can use any value between 1..255 for MALLOC_PERTURB_ That chooses the byte that glibc will use to memset all freed buffers. I set it like this in a shell start-up file: export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) Using a random value is slightly better than using a fixed one in case your fixed value is someday just the right/wrong value to mask a problem. At least with a random value, if you rerun the test in a different shell, the odds are good you won't use the unfortunate setting again.