controlflow / resharper-heapview

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

AsEnumerable reports an object allocation for refence types #105

Closed ovska closed 1 year ago

ovska commented 1 year ago

This is almost a non-issue, but AsEnumerable reports "Object allocation: LINQ method call" when used on reference types. When used on a struct, an allocation is reported on the variable as well as a "Boxing allocation". For unrestricted generics, a possible boxing is reported as well. From what I understand, only one boxing is done in that case as AsEnumerable returns the parameter as-is.

Proposal: exclude AsEnumerable from the list of allocating LINQ methods. This should fix all of these cases.

controlflow commented 1 year ago

"LINQ method call" allocation inspector was removed, will be eventually replaced with the inspection that reports manually-annotated BCLs methods that do allocate