1. As your program proved, "$depth" variable does not
goes away at "#5" because it is used in sub "recurse" (hence REFCNT($depth)++ few times). And it was allocated during compile stage, to perform some optimizations here
in reply to sub and anonymous sub
2. I'll suggest you to read "perlsub" and not "perlguts", and may be after that reading "perlcall" also will help getting you deeper into your question.
Courage, the Cowardly Dog.
PS. Something fishy is going on there, or my name is Vadim Konovalov. And it's not.