Re:Goroutines, Nonblocking I/O, and Memory Usage
by gpderetta on Friday January 06, 2017 @06:36AM
(#13335543)
allocating a new buffer doesn't give any guarantee as you might be given back a just dealocated buffer by the allocator with its original content mostly intact. You need to explicitly scrub any sensitive data yourself before deallocating. At that point you might just reuse the buffer yourself.
There is a security concern here; you'd better be sure to flush the buffers correctly or you could cause memory to leak between sessions.
If I were writing a server to handle a sensitive task such as executing payment transactions I'd probably take the less memory efficient approach of allocating a new buffer for every connection to lower the risk of data spilling between connections.