News for hackers. Stuff that matters.
Re:How to zero a buffer by rchowe on Thursday September 04, 2014 @07:42PM (#8271375)
Would it be possible to read a value from the array and do something with it (e.g. send it to /dev/null)? Even a JIT shouldn't be able to optimize the value out if you're actually using the value, and as long as you're not zeroing secure memory all the time, the performance hit shouldn't be that large.

This might cause side effects if /dev/null does not exist or is not the null device.

Re:How to zero a buffer by pcwalton on Thursday September 04, 2014 @07:52PM (#8271416)
A compiler could just forward the zero from the memset directly to your write syscall and delete the memset (and I would certainly implement this optimization in a compiler if I found it helped real code).