unitialized memory is all zeros...why not garbage instead?

Dan Nelson dnelson at allantgroup.com
Fri Jun 10 22:43:12 GMT 2005


In the last episode (Jun 10), Mike Hunter said:
> I have a feeling that I'm missing something really obvious, but I'm
> having trouble understanding why the following program:
> 
> int main (int argc, char * argv[])
> {
> 	void * ptr = malloc(65536);
> 
> Never prints anything but "0"'s.

The kernel zeros out memory before handing it to processes.

-- 
	Dan Nelson
	dnelson at allantgroup.com


More information about the freebsd-hackers mailing list