On Thu, Jan 26, 2017 at 2:21 AM, josvazg <josv...@gmail.com> wrote:
> Thanks a lot Ian!
>
> My mind picture of the runtime is more detailed now. I guess for more I 
> should now read the code itself.
>
> Just one side issue. You said:
> "
> Memory allocated on the stack in function F can not be used by callees
> of F.  After F returns, the memory is gone.
> "
>
> I don't quite get it.
>
> As I understand it, a caller is earlier in the stack that any of the 
> functions it calls (callees), so those callees will always return before the 
> caller does, their scope is a subset of the caller's.
>
> As such, the fact that the callers locals are gone when it returns does not 
> matter to the callees, which have already been long gone by then.
>
> That is, of course, if those callees are using that callers variables locally 
> only, not passing then elsewhere (other Goroutines, effectively other 
> stacks). That is, there is no variable escape from the stack.
>
> What did I miss here?

You're right, sorry, I mixed callee and caller.  Functions that F
calls can freely refer to memory allocated by F on the stack.

Ian

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to