dns: Memory usage issue cause dns stuck
In
func (srv *Server) serveDNS(w *response) {
req := new(Msg)
err := req.Unpack(w.msg)
if err != nil { // Send a FormatError back
x := new(Msg)
x.SetRcodeFormatError(req)
w.WriteMsg(x)
return
}
if !srv.Unsafe && req.Response {
return
}
Every dns request would create a new dns msg object, this make DNS library occupy a lot of memory. Is it OK to change it use sync.Pool?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 17 (5 by maintainers)
I confirm the improvement in the e875a31 Thanks
[ Quoting notifications@github.com in “Re: [miekg/dns] Memory usage issue …” ]
So, to safe memory we are going to copy it twice?