--- Coro/Coro/State.xs 2008/09/21 18:29:39 1.244 +++ Coro/Coro/State.xs 2008/09/22 05:40:21 1.245 @@ -363,7 +363,7 @@ while (&PL_sv_undef != (SV *)(padlist = (AV *)av_pop (av))) free_padlist (aTHX_ padlist); - SvREFCNT_dec (av); + SvREFCNT_dec (av); /* sv_magicext increased the refcount */ return 0; } @@ -668,17 +668,20 @@ else slot = coro->slot; - rss += sizeof (slot->curstackinfo); - rss += (slot->curstackinfo->si_cxmax + 1) * sizeof (PERL_CONTEXT); - rss += sizeof (SV) + sizeof (struct xpvav) + (1 + AvMAX (slot->curstack)) * sizeof (SV *); - rss += slot->tmps_max * sizeof (SV *); - rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32); - rss += slot->scopestack_max * sizeof (I32); - rss += slot->savestack_max * sizeof (ANY); + if (slot) + { + rss += sizeof (slot->curstackinfo); + rss += (slot->curstackinfo->si_cxmax + 1) * sizeof (PERL_CONTEXT); + rss += sizeof (SV) + sizeof (struct xpvav) + (1 + AvMAX (slot->curstack)) * sizeof (SV *); + rss += slot->tmps_max * sizeof (SV *); + rss += (slot->markstack_max - slot->markstack_ptr) * sizeof (I32); + rss += slot->scopestack_max * sizeof (I32); + rss += slot->savestack_max * sizeof (ANY); #if !PERL_VERSION_ATLEAST (5,10,0) - rss += slot->retstack_max * sizeof (OP *); + rss += slot->retstack_max * sizeof (OP *); #endif + } } return rss; @@ -1819,7 +1822,7 @@ eval = 1 CODE: { - if (coro->mainstack) + if (coro->mainstack && ((coro->flags & CF_RUNNING) || coro->slot)) { struct coro temp;