Skip to content

Commit 967b4e3

Browse files
committed
Just overwrite the records map when clearing
1 parent ed7c116 commit 967b4e3

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

pkg/recorder/recorder.go

+2-10
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,6 @@ func (r *Recorder) copy() record.MemoryRecords {
169169
func (r *Recorder) clear(records record.MemoryRecords) {
170170
r.lock.Lock()
171171
defer r.lock.Unlock()
172-
size := int64(0)
173-
for _, record := range records {
174-
existing, ok := r.records[record.Name]
175-
if !ok || existing.Data == nil || existing.At != record.At || existing.Fingerprint != record.Fingerprint {
176-
continue
177-
}
178-
size += int64(len(existing.Data))
179-
existing.Data = nil
180-
}
181-
r.size -= size
172+
r.records = make(map[string]*record.MemoryRecord, len(records))
173+
r.size = 0
182174
}

0 commit comments

Comments
 (0)