Skip to content

Commit

Permalink
statsitics: clear the fmsketch's map correctly (#49379) (#49402)
Browse files Browse the repository at this point in the history
close #49381
  • Loading branch information
ti-chi-bot authored Dec 13, 2023
1 parent cf7a0af commit 36a9e02
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions pkg/statistics/fmsketch.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,7 @@ func (s *FMSketch) MemoryUsage() (sum int64) {
}

func (s *FMSketch) reset() {
// not use hashset.Clear, it will release all memory and Not conducive to memory reuse.
// the size of set is not more than 10000.
set := make([]uint64, 0, s.hashset.Count())
s.hashset.Iter(func(k uint64, v bool) (stop bool) {
set = append(set, k)
return false
})
for _, k := range set {
s.hashset.Delete(k)
}
s.hashset.Clear()
s.mask = 0
s.maxSize = 0
}
Expand Down

0 comments on commit 36a9e02

Please sign in to comment.