Hacker News new | ask | show | jobs
by huhtenberg 1650 days ago
You capture by value a variable that allocates and you get a heap allocation.
1 comments

That's dependent on the captured type's copy (or move) behavior, and is completely different from your claim that how the lambda is used can influence this. Lambdas themselves never heap allocate.