Why are there memory allocations when calling a func : <p>I have the following program which construct a local Func from two static methods. But strangely, when I profile the program, it allocated close to a million Func objects. Why invoking Func object is also creating Func instances? </p>

<p><a href="https://i.stack.imgur.com/ndCfK.png" rel="noreferrer"><img src="https://i.stack.imgur.com/ndCfK.png" alt="enter image description here"></a></p>

<pre><code>public static class Utils
{
    public static bool ComparerFunc(long thisTicks, long thatTicks)
    {
        return thisTicks &lt; thatTicks;
    }
    public static int Foo(Guid[] guids, Func&lt;long, long, bool&gt; comparerFunc)
    {
        bool a = comparerFunc(1, 2);
        return 0;
    }
}
class Program
{
    static void Main(string[] args)
    {
        Func&lt;Guid[], int&gt; func = x =&gt; Utils.Foo(x, Utils.ComparerFunc);
        var guids = new Guid[10];
        for (int i = 0; i &lt; 1000000; i++)
        {
            int a = func(guids);
        }
    }
}
</code></pre>
