Erik Engheim
Nov 27, 2021

--

Good question Jesse! It is because if you allocate values on the stack, it doesn't get freed from the stack until after `return total`.

So escape analysis only applies to data created inside a function and returned from that function. If that function calls other functions, then you don't need to do escape analysis because data remains on the stack until you return from the function.

So no, you don't need to do any inlining of the addUp function.

--

--

Erik Engheim
Erik Engheim

Written by Erik Engheim

Geek dad, living in Oslo, Norway with passion for UX, Julia programming, science, teaching, reading and writing.

Responses (1)