Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!network!ucsd!ucbvax!agate!bionet!apple!sun-barr!texsun!playroom!cliffs
From: cliffs@suntrek.east.sun.com (Clifford C. Skolnick)
Newsgroups: comp.lang.c
Subject: Re: effect of free()
Message-ID: 
Date: 14 Aug 89 14:25:16 GMT
References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU>
Sender: news@playroom.UUCP
Followup-To: comp.lang.c
Lines: 25
In-reply-to: bph@buengc.BU.EDU's message of 14 Aug 89 04:09:01 GMT

In article <3756@buengc.BU.EDU> bph@buengc.BU.EDU (Blair P. Houghton) writes:

   >then if free() is called using ONE of the points, say pt1, as its 
   >argument, is the space pointed by pt1 really freed?

   Yes.  It can now be allocated to something else.  It is _not_,
   however, cleared or otherwise overwritten by free(), nor are
   any pointers into it deallocated or overwritten.

In current implimentations this is true.  But what if some person makes
a C library that actually returns the space to the operating system?  I
would change this to a no.

   >[questions about using the pointer]
   >My answer to this question SEEMS yes according to some tests I made.

   No intervening [mc]alloc()'s, no problem.  You have only your
   conscience to maintain.

Again, what if the memory was returned to the operating system?

			Cliff Skolnick

--
Cliff Skolnick			cliffs@sunrock.east.sun.com