4 ms·
Jens Gustedt suggested the following: memset(malloc(size), 0, 1) The program will crash if malloc returns NULL or the memory is not writable.
by anilakar 7y ago
Jens Gustedt suggested the following:
memset(malloc(size), 0, 1)
The program will crash if malloc returns NULL or the memory is not writable.
- hyperman1 7y agoAnd then memory deduplication comes along, finds out a huge number of identical pages (all zero) and decides to deduplicate them. So if you want your memory to stay real, I suppose you'd better fill it with random data or something.