The optree holds pointers to GVs under multiplicity. It's ithreads that differs.
[p5sagit/Devel-Size.git] / Size.xs
diff --git a/Size.xs b/Size.xs
index 1c8a0f3..b849cc1 100644 (file)
--- a/Size.xs
+++ b/Size.xs
@@ -333,7 +333,7 @@ magic_size(const SV * const thing, struct state *st) {
 static void
 check_new_and_strlen(struct state *st, const char *const p) {
     if(check_new(st, p))
-       st->total_size += strlen(p);
+       st->total_size += 1 + strlen(p);
 }
 
 static void
@@ -408,13 +408,18 @@ op_size(pTHX_ const OP * const baseop, struct state *st)
            TAG;break;
        case OPc_SVOP: TAG;
            st->total_size += sizeof(struct pmop);
-           sv_size(aTHX_ st, cSVOPx(baseop)->op_sv, TRUE);
+           if (!(baseop->op_type == OP_AELEMFAST
+                 && baseop->op_flags & OPf_SPECIAL)) {
+               /* not an OP_PADAV replacement */
+               sv_size(aTHX_ st, cSVOPx(baseop)->op_sv, TRUE);
+           }
            TAG;break;
       case OPc_PADOP: TAG;
          st->total_size += sizeof(struct padop);
          TAG;break;
        case OPc_PVOP: TAG;
            check_new_and_strlen(st, cPVOPx(baseop)->op_pv);
+           TAG;break;
        case OPc_LOOP: TAG;
            st->total_size += sizeof(struct loop);
            op_size(aTHX_ cLOOPx(baseop)->op_first, st);