proposal: net: ReadMsgUnix without source address #72068
Labels
LibraryProposal
Issues describing a requested change to the Go standard library or x/ libraries, but not to a tool
Proposal
Milestone
Proposal Details
Problem
Currently,
(*UnixConn) ReadMsgUnix()
reads a message from a unix socket, and returns a*UnixAddress
even when the calling code doesn't care about the source address. This allocation isn't optimized out by the compiler even when the calling code specifies _ for the return because it is referenced in some intermediate layers.Proposed Solution
Create
(*UnixConn) ReadMsgUnixIgnoreSource()
that returns(n, oobn, flags int, err error)
and the required underlying functions to support this so that programs that do not care about the source address don't allocate unused data on each call.Usecase
I'm trying to optimize dbus calls which require multiple calls to ReadMsgUnix per dbus message and I am trying to support this on a limited memory (embedded) system. So any time I can save not allocating and GC'ing is an improvement.
The text was updated successfully, but these errors were encountered: