Path: utzoo!attcan!utgpu!watmath!iuvax!purdue!bu-cs!buengc!bph From: bph@buengc.BU.EDU (Blair P. Houghton) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <3777@buengc.BU.EDU> Date: 15 Aug 89 16:33:21 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU><320@cubmol.BIO.COLUMBIA.EDU> Reply-To: bph@buengc.bu.edu (Blair P. Houghton) Followup-To: comp.lang.c Organization: Boston Univ. Col. of Eng. Lines: 22 In article <320@cubmol.BIO.COLUMBIA.EDU> ping@cubmol.UUCP (Shiping Zhang) writes: > >Now some new questions arises. Many people said that after free() >is called, the point used as the argument to free() is still valid >and can be used IF NO (mc)alloc()'s are called after the call to free(). >I understand the reason to say that is because that point still points >to the same space and the contents of it is not disturbed. Well, as many have informed me after I posted a response to the original, some implementations are not all implementations. It is possible that the call to free() may write into the freed block, and that the OS may gain control of it, and use it for whatever the system uses memory for. I guess the word is, once space is freed, don't even try to get data out of it. It's risky at least, and nonportable without question. --Blair "Four more compilers and daddy's got a new pair of shoes."