Is it safe to read to memory after it has been allocated with `pureMalloc` and `pureRealloc`?

Stanislav Blinov stanislav.blinov at gmail.com
Mon Apr 4 09:26:13 UTC 2022


On Monday, 4 April 2022 at 07:32:00 UTC, rempas wrote:
> In other terms, do these functions auto-initialize memory to be 
> ready for use?

No. Neither `malloc` nor `realloc` (for which D's `pure...` 
variants are mere wrappers) are specified to initialize allocated 
memory. `calloc`, however, is - it initializes allocated block 
with zeroes.


More information about the Digitalmars-d-learn mailing list