On Mar 5, 2005, at 8:53 AM, Steven N. Hirsch wrote:

I have been laboring under the belief that this simply marked the
structure for cleanup when the current context was exited. Am I confusing
'mortality' with base refcnt behavior?

yes, you are confusing them.

SvREFCNT_dec() is #defined to sv_free(). sv_free() (Perl_sv_free in sv.c) does the decrement and destroys the SV right then if the refcount is zero.

sv_2mortal() (Perl_sv_2mortal in sv.c) pushes the sv onto the tmps stack and marks it with SvTEMP_on(). the temps stack is cleaned up when exiting the current context. its refcount is not actually modified.

--
muppet <scott at asofyet dot org>



Reply via email to