Life after free?

J.T. Conklin jtc at van-bc.wimsey.bc.ca
Sat Oct 6 00:42:07 AEST 1990


In article <1990Oct5.002416.3196 at nntp-server.caltech.edu> manning at nntp-server.caltech.edu (Evan Marshall Manning) writes:
>You're missing the point.  Of course you can do what you like with your
>data.  But when you free() it you return it to the OS.  And anybody else
>can end up with your data when they next malloc().

In most systems, free()ed memory is not returned to the OS, it is
placed in malloc()'s unallocated memory pool to be assigned at some
subsequent malloc().

The time that memory is typically cleared, is when malloc() cannot
satisfy a request from its pool, and has to request more from the OS
with sbrk().  The OS then clears the memory before it is passed to
the process.

	--jtc




-- 
J.T. Conklin	UniFax Communications Inc.
		...!{uunet,ubc-cs}!van-bc!jtc, jtc at wimsey.bc.ca



More information about the Comp.lang.c mailing list