www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/11/05:17:11

Message-ID: <32D7639B.10A4@pobox.oleane.com>
Date: Sat, 11 Jan 1997 10:55:39 +0100
From: Francois Charton <deef AT pobox DOT oleane DOT com>
Organization: CCMSA
MIME-Version: 1.0
To: stockton AT bcm DOT tmc DOT edu
CC: djgpp AT delorie DOT com
Subject: Re: Malloc & Co.
References: <199701101926 DOT NAA21023 AT ginger DOT imgen DOT bcm DOT tmc DOT edu>

David Stockton wrote:
> 
> > John M. Aldrich wrote:
> > All memory that is allocated using sbrk(), malloc(), and its family, is
> > automatically freed by the DJGPP exit code.  It is, however, generally
> > good programming to clean things up yourself (although very few
> 
> I am not sure I agree with this statement.  Why should the user have to
> sit around and wait while some programs traverses all its arrays and
> linked lists freeing memory when it will make no difference at all?  I
>

The only case when this can be a problem is if you reuse some of your 
code in other applications, or add something to your program. You might 
then forget that some variable is not freed. 

What I would do about that would be to write the free() statement where 
they should be, but comment them out when they are unneeded. If I have to 
reuse my functions in another program, the commented free will act as a 
reminder.

Francois

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019