www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/04:35:52

From: Erik Max Francis <max AT alcyone DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: quick malloc question
Date: Sun, 02 Mar 1997 23:10:37 -0800
Organization: Alcyone Systems
Lines: 21
Message-ID: <331A796D.485A2646@alcyone.com>
References: <B0000041587 AT datasoft DOT datasoft DOT com DOT br> <331950FD DOT 4F9 AT cs DOT com>
NNTP-Posting-Host: newton.alcyone.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

John M. Aldrich wrote:

> Yes.  It's automatically freed by the program's exit code.  There are
> some purists who say you should free it anyway - I'm ambivalent on the
> issue.  :)

Yes, it's guaranteed that allocated memory will be freed upon program exit.

I only explicitly free allocated memory before exit (or in destructors or
what have you in C++) because 1. I consider it good style (but again, it's
a purist issue), and 2. if you change the program into a library or some
other context where it isn't necessarily operating in its own little world,
then you'll have to put it in at some point.

-- 
       Erik Max Francis, &tSftDotIotE / email:  max AT alcyone DOT com
                     Alcyone Systems /    web:  http://www.alcyone.com/max/
San Jose, California, United States /    icbm:  37 20 07 N  121 53 38 W
                                   \
              "I am become death, / destroyer of worlds."
                                 / J. Robert Oppenheimer (quoting legend)

- Raw text -


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