[svn:parrot] r39102 - trunk/src/pmc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat May 23 18:51:23 UTC 2009


Author: chromatic
Date: Sat May 23 18:51:22 2009
New Revision: 39102
URL: https://trac.parrot.org/parrot/changeset/39102

Log:
[PMC] Plugged a memory leak where initializing PMC metadata properties
allocated a C Hash for them twice, losing the pointer to the first one.  This
removes Rakudo's biggest memory leak in the 10k sub call program.

Modified:
   trunk/src/pmc/default.pmc
   trunk/src/pmc/hash.pmc

Modified: trunk/src/pmc/default.pmc
==============================================================================
--- trunk/src/pmc/default.pmc	Sat May 23 18:16:31 2009	(r39101)
+++ trunk/src/pmc/default.pmc	Sat May 23 18:51:22 2009	(r39102)
@@ -233,7 +233,6 @@
 
     PMC_metadata(self) = prop = pmc_new(interp, enum_class_Hash);
     GC_WRITE_BARRIER(interp, self, NULL, prop);
-    VTABLE_init(interp, prop);
     propagate_std_props(interp, self, prop);
     return prop;
 }

Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc	Sat May 23 18:16:31 2009	(r39101)
+++ trunk/src/pmc/hash.pmc	Sat May 23 18:51:22 2009	(r39102)
@@ -163,9 +163,10 @@
     }
 
     VTABLE void destroy() {
-        if (SELF.get_pointer()) {
-            parrot_hash_destroy(INTERP, (Hash *)SELF.get_pointer());
-        }
+        Hash *hash = (Hash *)SELF.get_pointer();
+        if (hash)
+            parrot_hash_destroy(INTERP, hash);
+
         mem_sys_free(PMC_data(SELF));
     }
 /*


More information about the parrot-commits mailing list