Skip to content

Commit

Permalink
fix gc for async file writer
Browse files Browse the repository at this point in the history
  • Loading branch information
phuslu committed Jun 14, 2024
1 parent b26fa41 commit e101692
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions async.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import (

// AsyncWriter is an Writer that writes asynchronously.
type AsyncWriter struct {
// Writer specifies the writer of output.
Writer Writer

// ChannelSize is the size of the data channel, the default size is 1.
ChannelSize uint

Expand All @@ -19,9 +22,6 @@ type AsyncWriter struct {
// WritevDisabled disables the writev syscall if the Writer is a FileWriter.
WritevDisabled bool

// Writer specifies the writer of output.
Writer Writer

once sync.Once
ch chan *Entry
chClose chan error
Expand Down
2 changes: 2 additions & 0 deletions async_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ func (w *AsyncWriter) writever() {
// return entries to pool
for i := 0; i < n; i++ {
epool.Put(es[i])
es[i] = nil
iovs[i].Base = nil
}
}
w.chClose <- err
Expand Down

0 comments on commit e101692

Please sign in to comment.