Skip to content

Commit

Permalink
Fix read buffer usage (#4860)
Browse files Browse the repository at this point in the history
Signed-off-by: Changxin Miao <[email protected]>
  • Loading branch information
polyrabbit authored May 17, 2024
1 parent 66c4c94 commit 5c63ef6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/vfs/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ func (s *sliceReader) delete() {
} else {
s.file.last = s.prev
}
atomic.AddInt64(&readBufferUsed, -int64(cap(s.page.Data)))
s.page.Release()
atomic.AddInt64(&readBufferUsed, -int64(s.block.len))
}

type session struct {
Expand Down Expand Up @@ -327,7 +327,7 @@ func (f *fileReader) newSlice(block *frange) *sliceReader {
*(f.last) = s
f.last = &(s.next)
go s.run()
atomic.AddInt64(&readBufferUsed, int64(s.block.len))
atomic.AddInt64(&readBufferUsed, int64(cap(s.page.Data)))
return s
}

Expand Down

0 comments on commit 5c63ef6

Please sign in to comment.