You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 15, 2025. It is now read-only.
Stream.Flush copies the contents of the stream's buffer to the output, but instead of resetting its buffer to reuse the allocation, it keeps appending to the end of the buffer. For large JSON objects this results in much more allocation than necessary.
// Flush writes any buffered data to the underlying io.Writer.func (stream*Stream) Flush() error {
ifstream.out==nil {
returnnil
}
ifstream.Error!=nil {
returnstream.Error
}
n, err:=stream.out.Write(stream.buf)
iferr!=nil {
ifstream.Error==nil {
stream.Error=err
}
returnerr
}
stream.buf=stream.buf[n:] // <--- HEREreturnnil
}