Question about malloc() and free()

Roger House roger at everexn.uucp
Tue Aug 28 04:40:58 AEST 1990


In <118073 at linus.mitre.org> rtidd at ccels3.mitre.org (Randy Tidd) writes:

>What happens to the space that was malloc'ed? It is never freed by me;
>will the compiler figure this out and arrange for it to be freed?  Is
>the resolution method standard over compilers?

The compiler will NOT figure out that something can be freed and then free
it.  Most likely the compiler has no idea that malloc is allocating memory.l
The compiler simply compiles the code needed to pass the parameters and
call the function.  It is up to the programmer to take care of freeing mem-
ory allocated by the programmer.

						Roger House



More information about the Comp.lang.c mailing list