Skip to content

Commit

Permalink
statsitics: clear the fmsketch's map correctly (#49379)
Browse files Browse the repository at this point in the history
close #49381
  • Loading branch information
hawkingrei authored Dec 12, 2023
1 parent 45b4e4a commit 24606a4
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 @@ -217,16 +217,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 24606a4

Please sign in to comment.