Kernel zeroes memory?

后端 未结 6 2130
醉梦人生
醉梦人生 2020-11-28 15:03

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 b

6条回答
  •  生来不讨喜
    2020-11-28 15:32

    Your code does not test if all memory is zeroed - it tests if two specific bytes are zero - a[0] and a[5000]. Also, malloc() has nothing to do with the kernel - it is a C library function, not a system call. It is highly unlikely that its implementers zero memory - what you are seeing is just some random quirk of your particular configuration.

提交回复
热议问题