Move SvSTASH counting from SVt_PVCV to >= SVt_PVMG
Florian Ragwitz [Sun, 30 Sep 2012 07:50:52 +0000 (16:50 +0900)]
I assume that certain stashes might not be reached using the previous
behaviour. Both objects and CVs (and possibly even others) can have a stash.
For anonymous stashes without CVs in them, I believe SvSTASH would not be
counted if an object blessed in said anonymous stash would be processed.

Memory.xs

index dcb0584..899de95 100644 (file)
--- a/Memory.xs
+++ b/Memory.xs
@@ -1172,7 +1172,6 @@ else warn("skipped suspect HeVAL %p", HeVAL(cur_entry));
   case SVt_PVCV: TAG;
     /* not CvSTASH, per https://rt.cpan.org/Ticket/Display.html?id=79366 */
     ADD_ATTR(st, NPattr_NAME, CvGV(thing) ? GvNAME(CvGV(thing)) : "UNDEFINED", 0);
-    sv_size(aTHX_ st, NPathLink("SvSTASH"), (SV *)SvSTASH(thing), SOME_RECURSION);
     sv_size(aTHX_ st, NPathLink("CvGV"), (SV *)CvGV(thing), SOME_RECURSION);
     padlist_size(aTHX_ st, NPathLink("CvPADLIST"), CvPADLIST(thing), recurse);
     sv_size(aTHX_ st, NPathLink("CvOUTSIDE"), (SV *)CvOUTSIDE(thing), SOME_RECURSION);
@@ -1273,6 +1272,8 @@ else warn("skipped suspect HeVAL %p", HeVAL(cur_entry));
       magic_size(aTHX_ thing, st, NPathLink("MG"));
     if (SvPAD_OUR(thing) && SvOURSTASH(thing))
       sv_size(aTHX_ st, NPathLink("SvOURSTASH"), (SV *)SvOURSTASH(thing), SOME_RECURSION);
+    if (SvSTASH(thing))
+      sv_size(aTHX_ st, NPathLink("SvSTASH"), (SV *)SvSTASH(thing), SOME_RECURSION);
   }
 
   return;