From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10533 invoked by alias); 5 Jun 2013 17:44:52 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 10523 invoked by uid 89); 5 Jun 2013 17:44:51 -0000 X-Spam-SWARE-Status: No, score=-6.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 05 Jun 2013 17:44:51 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r55HilpJ032492 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 5 Jun 2013 13:44:48 -0400 Received: from barimba (ovpn-113-72.phx2.redhat.com [10.3.113.72]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r55HijCe021115 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 5 Jun 2013 13:44:46 -0400 From: Tom Tromey To: Joel Brobecker Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: RFC: introduce scoped cleanups References: <87li7ohtiu.fsf@fleche.redhat.com> <87ppw8qlgl.fsf@fleche.redhat.com> <20130531061135.GA12363@adacore.com> <87obbrp2hg.fsf@fleche.redhat.com> <51A8CC81.9070509@redhat.com> <8738t2q4o2.fsf@fleche.redhat.com> <20130603060716.GC12363@adacore.com> Date: Wed, 05 Jun 2013 17:44:00 -0000 In-Reply-To: <20130603060716.GC12363@adacore.com> (Joel Brobecker's message of "Mon, 3 Jun 2013 10:07:16 +0400") Message-ID: <87wqq8ih9u.fsf@fleche.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-SW-Source: 2013-06/txt/msg00088.txt.bz2 Joel> A very valid concern, IMO! I've never seen heap allocation as Joel> a reason for concern with respect to performance, and thus have Joel> never hesitated calling malloc. The only reason I have prefered Joel> alloca whenever possible is that it allows me to be lazy :-)! It doesn't happen much, but you can see a few spots where someone coded around the malloc call -- the various conditional cleanups that my series removed. Joel> But this made me realize something: Why would someone want to do Joel> stack-cleanups instead of just calling alloca directly? Since Joel> alloca is basically a call-and-forget, what's the advantage of Joel> going through a stack-based cleanup? It is the difference between running the cleanup and freeing the memory that is used by the cleanup object itself. Joel> Regardless of the above, I like the idea of performing the cleanups Joel> on an obstack; fast and yet a little more resilient to programming Joel> errors. Not sure if that would be something easy to implement or not, Joel> though. It ought to be easy. I will look into it. Tom