Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Memory Leak Detection Date: Wed, 14 Sep 2011 20:29:58 +1200 Lines: 18 Message-ID: <9db706F784U5@mid.individual.net> References: <7be371ee-c86c-4686-adbb-d0f3f716cde9@j1g2000yqn.googlegroups.com> <1073300f-64a0-4665-9e6e-a5000808b407@z7g2000vbp.googlegroups.com> <4e70444c$0$4388$7b1e8fa0@news.nbl.fi> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net qc1Fk9AsV5GHp3okxLZcgAkb8aDiOdWNFBSjbAS/ccGC/9jBQ9 Cancel-Lock: sha1:auZJ3tNz8Geh1ff7PmO09sNpQvI= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: <4e70444c$0$4388$7b1e8fa0@news.nbl.fi> Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:10098 On 09/14/11 06:06 PM, Juha Nieminen wrote: > Miles Bader wrote: >> [Running valgrind on a program for the first time can be a rude shock >> though, revealing tons of little bugs that you never noticed before!] > > Actually if you have followed the basic rules of RAII and all the > rules that naturally follow from it (such as the so-called rule of > three, never use a raw 'new', use the STL whenever it's suitable, and > so on), such bugs become rarer and rarer. The most recent one I found (using dbx, not valgrind) was a bug in a system library flushed out by me using RAII to match library allocations and deallocations. With the "proper" code I got duplicate free errors and without it I got a memory leak! In the end I settled for the leak and a bug report. -- Ian Collins