Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #6907

Re: Should you free your pointers?

From Martin Ambuhl <mambuhl@earthlink.net>
Newsgroups comp.lang.c
Subject Re: Should you free your pointers?
Date 2011-06-24 19:04 -0400
Organization A noiseless patient Spider
Message-ID <iu3570$bpf$1@dont-email.me> (permalink)
References <iu2sov$3dv$1@speranza.aioe.org>

Show all headers | View raw


On 6/24/2011 4:41 PM, Billy Mays wrote:
> In the case where you know that your program will be terminating after
> it is done using the pointers, should you even bother freeing the space up?

You should always free any space you have allocated.  There is no 
guarantee that the OS will do it for you.  Even if the OS you are 
currently using claims it will do so, relying on such behavior makes 
your code non-portable and there is no warrant in the C standard for 
expecting otherwise (since the C standard can hardly decree such this 
for the OS).

> Example:

No example is needed.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Should you free your pointers? Billy Mays <noway@nohow.com> - 2011-06-24 16:41 -0400
  Re: Should you free your pointers? Shao Miller <sha0.miller@gmail.com> - 2011-06-24 16:51 -0400
    Re: Should you free your pointers? Shao Miller <sha0.miller@gmail.com> - 2011-06-24 16:56 -0400
    Re: Should you free your pointers? falk@rahul.net (Edward A. Falk) - 2011-06-26 04:09 +0000
  Re: Should you free your pointers? Nobody <nobody@nowhere.com> - 2011-06-24 21:53 +0100
    Re: Should you free your pointers? Martin Ambuhl <mambuhl@earthlink.net> - 2011-06-24 19:06 -0400
  Re: Should you free your pointers? Ben Pfaff <blp@cs.stanford.edu> - 2011-06-24 14:05 -0700
    Re: Should you free your pointers? David Mathog <dmathog@gmail.com> - 2011-06-28 09:36 -0700
  Re: Should you free your pointers? Ian Collins <ian-news@hotmail.com> - 2011-06-25 09:31 +1200
  Re: Should you free your pointers? Martin Ambuhl <mambuhl@earthlink.net> - 2011-06-24 19:04 -0400
  Re: Should you free your pointers? Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-06-24 21:19 -0400
    Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-25 15:15 -0700
      Re: Should you free your pointers? Keith Thompson <kst-u@mib.org> - 2011-06-25 15:44 -0700
        Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-26 12:56 -0700
          Re: Should you free your pointers? Keith Thompson <kst-u@mib.org> - 2011-06-26 13:08 -0700
            Re: Should you free your pointers? Geoff <geoff@invalid.invalid> - 2011-06-26 14:33 -0700
            Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-26 16:27 -0700
        Re: Should you free your pointers? James Kuyper <jameskuyper@verizon.net> - 2011-06-26 19:39 -0400
          Re: Should you free your pointers? Keith Thompson <kst-u@mib.org> - 2011-06-26 19:28 -0700
            Re: Should you free your pointers? James Waldby <not@valid.invalid> - 2011-06-27 05:42 +0000
            Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-27 12:59 -0700
              Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-27 13:06 -0700
              Re: Should you free your pointers? Seebs <usenet-nospam@seebs.net> - 2011-06-27 20:26 +0000
              Re: Should you free your pointers? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-06-27 14:28 -0600
              Re: Should you free your pointers? pacman@kosh.dhis.org (Alan Curry) - 2011-06-27 23:29 +0000
              Re: Should you free your pointers? pete <pfiland@mindspring.com> - 2011-06-27 21:08 -0400
              Re: Should you free your pointers? "J. J. Farrell" <jjf@bcs.org.uk> - 2011-06-28 04:05 +0100
                Re: Should you free your pointers? Billy Mays <noway@nohow.com> - 2011-06-28 00:25 -0400
                Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-28 01:23 -0700
                Re: Should you free your pointers? Shao Miller <sha0.miller@gmail.com> - 2011-06-28 01:00 -0500
                Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-28 01:22 -0700
                Re: Should you free your pointers? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-06-28 10:02 -0600
                Re: Should you free your pointers? "J. J. Farrell" <jjf@bcs.org.uk> - 2011-06-29 02:41 +0100
                Re: Should you free your pointers? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2011-06-28 19:47 -0600
              Re: Should you free your pointers? James Kuyper <jameskuyper@verizon.net> - 2011-06-28 08:21 -0400
                Re: Should you free your pointers? Michael Press <rubrum@pacbell.net> - 2011-06-30 15:43 -0700
              Re: Should you free your pointers? Keith Thompson <kst-u@mib.org> - 2011-06-28 22:36 -0700
  Re: Should you free your pointers? James Kuyper <jameskuyper@verizon.net> - 2011-06-24 22:07 -0400
    Re: Should you free your pointers? Nobody <nobody@nowhere.com> - 2011-06-25 15:27 +0100
  Re: Should you free your pointers? China Blue Dolls <chine.bleu@yahoo.com> - 2011-06-27 18:16 -0700
  Re: Should you free your pointers? DDD <1983ddd@gmail.com> - 2011-06-28 19:41 -0700

csiph-web