is D so slow?

Fawzi Mohamed fmohamed at mac.com
Tue Jun 17 03:23:12 PDT 2008


On 2008-06-17 04:13:14 +0200, Robert Fraser <fraserofthenight at gmail.com> said:

> Fawzi Mohamed wrote:
>> If you use malloc, the default initialization does not take place, the 
>> memory is normally either initialized to 0, or left uninitialized (with 
>> values that likely are not NaN).
> 
> If I remember right, malloc does no initialization; calloc initializes to 0.

Indeed calloc is documented to always initialize to 0.

I think that by default when reusing memory malloc does not initialize 
it (but normally you can set environment variables to change this 
behaviour).
When getting the memory from the system initialization might (and often 
will) take place so that a program cannot "sniff" the memory of other 
programs.
The thing is system dependent, malloc gives no guarantee with respect 
to any special behavior.

Fawzi



More information about the Digitalmars-d-learn mailing list