Skip to content

[SymDB] DEBUG-4760 Fix "Not enough space for all closure methods"#8101

Merged
dudikeleti merged 1 commit intomasterfrom
dudik/symdb/fix-missing-closures-issue
Jan 23, 2026
Merged

[SymDB] DEBUG-4760 Fix "Not enough space for all closure methods"#8101
dudikeleti merged 1 commit intomasterfrom
dudik/symdb/fix-missing-closures-issue

Conversation

@dudikeleti
Copy link
Contributor

Summary of changes

Fixed an issue where we could drop compiler-generated closure methods and emit "Not enough space for all closure methods".

Reason for change

Dropping closure methods reduces accuracy (missing closures in symbol data) and produces noisy warnings for valid user code. The fix keeps the path efficient while ensuring correctness.

Implementation details

Improve heuristic for the rented array:
estimatedCapacity = methods.Count * 2 + nestedTypes.Length * 4, with a small minimum and int.MaxValue clamp.
If the heuristic is still too small, grow the pooled buffer on demand (×2).

Test coverage

Added SymbolExtractorTest.DoesNotDropClosureMethodsWhenThereAreMany to assert we extract all closure scopes for a sample with ManyClosures.ClosureCount lambdas.

@dudikeleti dudikeleti requested a review from a team as a code owner January 23, 2026 17:12
@dudikeleti dudikeleti enabled auto-merge (squash) January 23, 2026 17:39
@pr-commenter
Copy link

pr-commenter bot commented Jan 23, 2026

Benchmarks

Benchmark execution time: 2026-01-23 17:54:29

Comparing candidate commit 51f3fb1 in PR branch dudik/symdb/fix-missing-closures-issue with baseline commit a7f09d3 in branch master.

Found 10 performance improvements and 7 performance regressions! Performance is the same for 152 metrics, 23 unstable metrics.

scenario:Benchmarks.Trace.AgentWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟥 execution_time [+82.457ms; +82.767ms] or [+68.236%; +68.493%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleMoreComplexBody net6.0

  • 🟩 execution_time [-23.181ms; -19.485ms] or [-10.538%; -8.857%]

scenario:Benchmarks.Trace.Asm.AppSecBodyBenchmark.AllCycleSimpleBody netcoreapp3.1

  • 🟥 execution_time [+12.092ms; +18.378ms] or [+6.130%; +9.317%]

scenario:Benchmarks.Trace.Asm.AppSecEncoderBenchmark.EncodeLegacyArgs net6.0

  • 🟩 execution_time [-25.833ms; -25.509ms] or [-12.949%; -12.787%]

scenario:Benchmarks.Trace.AspNetCoreBenchmark.SendRequest net6.0

  • 🟩 execution_time [-93.929ms; -92.280ms] or [-48.852%; -47.995%]

scenario:Benchmarks.Trace.CIVisibilityProtocolWriterBenchmark.WriteAndFlushEnrichedTraces net6.0

  • 🟩 execution_time [-53.246ms; -45.854ms] or [-24.445%; -21.052%]
  • 🟩 throughput [+96.858op/s; +156.266op/s] or [+6.933%; +11.185%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net472

  • 🟥 execution_time [+316.401µs; +363.373µs] or [+16.802%; +19.296%]
  • 🟥 throughput [-85.641op/s; -76.157op/s] or [-16.127%; -14.341%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice net6.0

  • 🟩 execution_time [-90.492µs; -84.241µs] or [-5.902%; -5.494%]
  • 🟩 throughput [+37.939op/s; +40.886op/s] or [+5.817%; +6.269%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OptimizedCharSlice netcoreapp3.1

  • 🟩 execution_time [-884.147µs; -620.460µs] or [-31.898%; -22.385%]

scenario:Benchmarks.Trace.CharSliceBenchmark.OriginalCharSlice net472

  • 🟥 execution_time [+445.181µs; +504.449µs] or [+17.097%; +19.373%]
  • 🟥 throughput [-62.208op/s; -55.972op/s] or [-16.198%; -14.574%]

scenario:Benchmarks.Trace.DbCommandBenchmark.ExecuteNonQuery net6.0

  • 🟩 throughput [+36759.904op/s; +52185.308op/s] or [+7.250%; +10.292%]

scenario:Benchmarks.Trace.GraphQLBenchmark.ExecuteAsync net472

  • 🟥 throughput [-36401.435op/s; -32160.314op/s] or [-9.232%; -8.156%]

scenario:Benchmarks.Trace.Log4netBenchmark.EnrichedLog netcoreapp3.1

  • 🟩 execution_time [-13.299ms; -11.494ms] or [-7.591%; -6.560%]

@dudikeleti dudikeleti merged commit 7a2c126 into master Jan 23, 2026
153 of 154 checks passed
@dudikeleti dudikeleti deleted the dudik/symdb/fix-missing-closures-issue branch January 23, 2026 18:34
@github-actions github-actions bot added this to the vNext-v3 milestone Jan 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants