summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--internal/flamegraph/livetrie.go3
-rw-r--r--internal/ior.go1
-rw-r--r--internal/tui/flamegraph/bench_test.go1
-rw-r--r--internal/tui/flamegraph/stress_test.go12
4 files changed, 11 insertions, 6 deletions
diff --git a/internal/flamegraph/livetrie.go b/internal/flamegraph/livetrie.go
index 794b790..600e404 100644
--- a/internal/flamegraph/livetrie.go
+++ b/internal/flamegraph/livetrie.go
@@ -77,11 +77,10 @@ func (lt *LiveTrie) invalidateCache() {
lt.cacheMu.Unlock()
}
-// Ingest adds one event pair into the live trie and recycles the pair.
+// Ingest adds one event pair into the live trie.
func (lt *LiveTrie) Ingest(ep *event.Pair) {
record := eventPairToRecord(ep)
lt.AddRecord(record)
- ep.Recycle()
}
// AddRecord adds one already-decoded flamegraph record into the live trie.
diff --git a/internal/ior.go b/internal/ior.go
index 2a5d1b9..5ebc360 100644
--- a/internal/ior.go
+++ b/internal/ior.go
@@ -203,6 +203,7 @@ func tuiTraceStarterFromRunTrace(
engine.Ingest(ep)
streamEvents <- eventstream.NewStreamEvent(ep.EnterEv.GetTime(), ep)
liveTrie.Ingest(ep)
+ ep.Recycle()
}
el.warningCb = func(message string) {
// Drop warning notifications if the stream channel is saturated.
diff --git a/internal/tui/flamegraph/bench_test.go b/internal/tui/flamegraph/bench_test.go
index 05c6526..33d77d1 100644
--- a/internal/tui/flamegraph/bench_test.go
+++ b/internal/tui/flamegraph/bench_test.go
@@ -298,6 +298,7 @@ func BenchmarkLiveTrieIngestAndSnapshot(b *testing.B) {
buildBenchmarkPath(8, 6, eventIdx),
)
liveTrie.Ingest(pair)
+ pair.Recycle()
}
payload, _ := liveTrie.SnapshotJSON()
diff --git a/internal/tui/flamegraph/stress_test.go b/internal/tui/flamegraph/stress_test.go
index d2bd74a..e53e4d5 100644
--- a/internal/tui/flamegraph/stress_test.go
+++ b/internal/tui/flamegraph/stress_test.go
@@ -82,13 +82,15 @@ func TestStressHighEventRate(t *testing.T) {
if seed%2 == 0 {
traceID = types.SYS_ENTER_WRITE
}
- liveTrie.Ingest(newBenchmarkPair(
+ pair := newBenchmarkPair(
fmt.Sprintf("worker-%d", worker),
traceID,
uint32(1000+worker),
uint32(200000+seed),
buildBenchmarkPath(6, 3, seed),
- ))
+ )
+ liveTrie.Ingest(pair)
+ pair.Recycle()
}
}()
}
@@ -221,12 +223,14 @@ func ingestStressEvents(liveTrie *coreflamegraph.LiveTrie, count, seedBase int)
} else if seed%2 == 0 {
traceID = types.SYS_ENTER_WRITE
}
- liveTrie.Ingest(newBenchmarkPair(
+ pair := newBenchmarkPair(
fmt.Sprintf("stress-%d", seed%8),
traceID,
uint32(1200+(seed%64)),
uint32(300000+seed),
buildBenchmarkPath(9, 5, seed),
- ))
+ )
+ liveTrie.Ingest(pair)
+ pair.Recycle()
}
}