diff options
Diffstat (limited to 'src/runtime/trace')
| -rw-r--r-- | src/runtime/trace/annotation_test.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/runtime/trace/annotation_test.go b/src/runtime/trace/annotation_test.go index ea10843230..63e01fab9c 100644 --- a/src/runtime/trace/annotation_test.go +++ b/src/runtime/trace/annotation_test.go @@ -8,9 +8,22 @@ import ( "context" "io" . "runtime/trace" + "strings" "testing" ) +func TestStartRegionLongString(t *testing.T) { + // Regression test: a region name longer than the trace region + // allocator's block size (~64KB) used to crash with + // "traceRegion: alloc too large" because traceStringTable.put + // inserted the full string into the trace map before truncation. + Start(io.Discard) + defer Stop() + + big := strings.Repeat("x", 70_000) + StartRegion(context.Background(), big).End() +} + func BenchmarkStartRegion(b *testing.B) { b.ReportAllocs() ctx, task := NewTask(context.Background(), "benchmark") |
