BufferReadUntilBlock should release buf when no bytes read
This was causing allocations every time there was a non-blocking read with nothing to read. https://github.com/jackc/pgx/issues/1481
This commit is contained in:
@@ -317,6 +317,8 @@ func (c *NetConn) BufferReadUntilBlock() error {
|
||||
if n > 0 {
|
||||
buf = buf[:n]
|
||||
c.readQueue.pushBack(buf)
|
||||
} else if n == 0 {
|
||||
iobufpool.Put(buf)
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user