2 ms·
For some situations it's certainly like you say - not important to initialize memory upon allocation. That's how malloc is ordinarily implemented. If your allo
by wyldfire 4y ago
For some situations it's certainly like you say - not important to initialize memory upon allocation. That's how malloc is ordinarily implemented.
If your allocation is about to take on a matrix that you will load from a default value or calculation for every cell - that would only suffer unnecessary latency if memory were zeroed on allocation.
But if your allocation is about to take on a struct with many fields and elements, it could be easily misused by not initializing every field (including when new fields are added), then a zero or other default initialization might be convenient.