Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Shao Miller <sha0.miller@gmail.com> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Should you free your pointers? |
| Date | 2011-06-24 16:56 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <iu2too$tle$1@dont-email.me> (permalink) |
| References | <iu2sov$3dv$1@speranza.aioe.org> <iu2tf6$rm7$1@dont-email.me> |
On 6/24/2011 16:51, Shao Miller wrote:
> On 6/24/2011 16:41, 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?
>>
>> Example:
>> int main(void)
>> {
>> int i, * data;
>> data = malloc(sizeof(int) * 100);
>> if(data) {
>> for(i = 0; i < 100; i++) {
>> data[i] = i'
>> }
>> }
>> /* free(data) ? */
>> return 0;
>> }
>
> I've seen arguments for:
> - Program performance
> - Program size
>
> And against:
> - Programmer habit
> - Cases where program termination doesn't free memory allocated by the
> program
>
> I think it's a worth-while habit to 'free' them, in general.
Uh, I meant "for not bothering" and "against not bothering." :)
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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