Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do anonymous methods consume memory?

Do Anonymous Methods, Delegates, Action, Func and alike, allocate/consume/eat memory on your computer?

If so, do they allocate same memory on each variable on captured code block?

like image 512
Freddie Fabregas Avatar asked Jul 30 '26 18:07

Freddie Fabregas


1 Answers

Of course they do, just like any other normal function. How can they be executed at run time if they wouldn't be "stored" somewhere in memory?

But if you are asking if they consume more memory on every call (as in allocating dynamic memory), then no, they don't do that on their own.

like image 148
Sil Avatar answered Aug 01 '26 07:08

Sil



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!