From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24335 invoked by alias); 11 Feb 2003 23:40:54 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 24328 invoked from network); 11 Feb 2003 23:40:54 -0000 Received: from unknown (HELO jackfruit.Stanford.EDU) (171.64.38.136) by 172.16.49.205 with SMTP; 11 Feb 2003 23:40:54 -0000 Received: (from carlton@localhost) by jackfruit.Stanford.EDU (8.11.6/8.11.6) id h1BNeqQ18383; Tue, 11 Feb 2003 15:40:52 -0800 X-Authentication-Warning: jackfruit.Stanford.EDU: carlton set sender to carlton@math.stanford.edu using -f To: gdb Subject: How much should I cleanup? From: David Carlton Date: Tue, 11 Feb 2003 23:40:00 -0000 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-02/txt/msg00193.txt.bz2 When is it important to make sure that I have cleanups in place? My understanding is that it's important if I have control of a block of memory that I want to xfree() after doing some work, but where that xfree() might not be reached because of exceptional circumstances. So, if that's correct: what are 'exceptional circumstances'? I assume error() and related functions count. I don't know exactly what QUIT does; do I have to be careful if there are QUIT's in between the xmalloc() and the xfree()? (Are those the only places where GDB pays attention to ^C's?) Any other situations? Sigh. C has its benefits, but ease of memory management isn't one of them. Every time I have to write a cleanup function, every time I have to think about whether to alloca() memory for a string or to xmalloc() it (and every time I can't alloca() it because I'm returning the string in question), I get another grey hair. (Though the grey hair falls out soon thereafter, for better or for worse.) David Carlton carlton@math.stanford.edu