I am using Debian squeeze and have noticed that memory is always zeroed. Is this new in linux distributions ? Some time ago, I believe I could use puts() and garbage would be output.
I run this test program many times but the commented results are always the same. (I have randomize_va_space=2 in sysctl.conf so I know that memory in different locations is being used at each run.)
char *a = malloc(50000000);
a[49999999] = '';
puts(a); // it outputs nothing since all are zeroes
printf("%p
", a);
if(a[5000] == '') // this condition is always true
{
puts("It is a nul char.");
}
Is it possible to make the system not zero memory ? What options could this Debian squeeze installation have activated that always zero memory ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…