controlflow / resharper-heapview

ReSharper Heap Allocations Viewer plugin
MIT License
303 stars 28 forks source link

Wrong parameter closure allocation warning #87

Closed DedSec256 closed 1 year ago

DedSec256 commented 3 years ago

Repro code:

using System.Linq;

class Example
{
  public void A()
  {
    var a = new[] { new[] { 1 } }
      .SelectMany(y => y.Select(x => y[x]))
      .Select(t => t);
  }
}

If lambda argument is closed in one of the lambdas in the LINQ chain, subsequent calls in the chain also indicate the allocation of the closure from the lambda argument, which seems suspicious.

image

controlflow commented 1 year ago

Fixed some time ago, no longer reproduces image