diff --git a/lib/g3-histogram/src/keeping.rs b/lib/g3-histogram/src/keeping.rs index 89a39664..8424cad6 100644 --- a/lib/g3-histogram/src/keeping.rs +++ b/lib/g3-histogram/src/keeping.rs @@ -103,6 +103,7 @@ where for v in buf.iter().take(count) { let _ = self.inner.record(v.as_u64()); } + buf.clear(); stats.update(self.inner()); } }); diff --git a/lib/g3-histogram/src/rotating.rs b/lib/g3-histogram/src/rotating.rs index c4f102dd..cd6b661d 100644 --- a/lib/g3-histogram/src/rotating.rs +++ b/lib/g3-histogram/src/rotating.rs @@ -110,6 +110,7 @@ where for v in buf.iter().take(n) { let _ = self.inner.record(v.as_u64()); } + buf.clear(); } _ = rotate_interval.tick() => { if !self.inner.is_empty() {