In message: <[EMAIL PROTECTED]> Mike Hunter <[EMAIL PROTECTED]> writes: : Is the pre-zeroing of malloc'd memory documented somewhere? By my reading : of the malloc manapge... : : The calloc() function allocates space for number objects, each size : bytes in length. The result is identical to calling malloc() with an : argument of ``number * size'', with the exception that the allocated : memory is explicitly initialized to zero bytes. : : ...it seems like it's saying that malloc (as opposed to calloc) is NOT : pre-zeroed. Is there a different document I should be reading?
The memory isn't given to the process by malloc. It is given to it by some other means. That memory is zeroed for security reasons. The first time malloc returns the memory, with our current implementation, it will be all zeros. After that, all bets are off with out implementation. One should not rely on this behavior because one never knows when the first malloc happens, nor if our malloc might start writing into the memory it is about to return... Warner _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"