Skip to content

Commit

Permalink
fix: check mem != nil before calling Mem() (tikv#1236)
Browse files Browse the repository at this point in the history
Signed-off-by: ekexium <[email protected]>
  • Loading branch information
ekexium authored Mar 18, 2024
1 parent 73c0712 commit a9128e8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/unionstore/pipelined_memdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,14 @@ func (p *PipelinedMemDB) onMemChange() {

// Mem returns the memory usage of MemBuffer.
func (p *PipelinedMemDB) Mem() uint64 {
return p.memDB.Mem() + p.flushingMemDB.Mem()
var mem uint64
if p.memDB != nil {
mem += p.memDB.Mem()
}
if p.flushingMemDB != nil {
mem += p.flushingMemDB.Mem()
}
return mem
}

type errIterator struct {
Expand Down

0 comments on commit a9128e8

Please sign in to comment.