Path: utzoo!utgpu!watmath!iuvax!rutgers!columbia!cubmol!ping From: ping@cubmol.BIO.COLUMBIA.EDU (Shiping Zhang) Newsgroups: comp.lang.c Subject: Re: effect of free() Message-ID: <320@cubmol.BIO.COLUMBIA.EDU> Date: 14 Aug 89 18:01:56 GMT References: <319@cubmol.BIO.COLUMBIA.EDU> <3756@buengc.BU.EDU>Reply-To: ping@cubmol.UUCP (Shiping Zhang) Organization: Dept. of Biology, Columbia Univ., New York, NY Lines: 23 After I posted the question, I got many responces from both the network and e-mail. They certainly answered my original questions and clarified a lot of confusions I had. I am very grateful to all of them. 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. (Same to the other points point to the same space.) But I work on a Sun3 machine under unix system, there are more than one process running at the same time. So will other processes take that space and change its contents? The answer must be yes to my understanding. Please confirm me. Even if no (mc)alloc()'s are called after free() in a process, how about calls to other functions with local varibles? The memory spaces for local varibles of functions are fixed at the begining of a process or allocated dynamically by the parent process or by the operating system? If the space for local varibles are allocated dynamically, will the space freed by free() be allocated for local varibles? -ping