The Box You Pay For Is the One That Escapes
Assigning a struct to an interface allocated 0 bytes. Passing it across a call boundary allocated 24. A constrained generic allocated none, until its body asked for an object.

S/02 · Series · 2 parts
Where an object actually goes, what the JIT can keep off the heap, and how much of the difference survives contact with production code.
Assigning a struct to an interface allocated 0 bytes. Passing it across a call boundary allocated 24. A constrained generic allocated none, until its body asked for an object.

A lambda that captures an int allocated 24 bytes on .NET 10.0.12; the same lambda reading a constant allocated none. The delegate was optional, the display class was not.
