[svn:parrot] r39077 - trunk/src/gc

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sat May 23 11:05:50 UTC 2009


Author: chromatic
Date: Sat May 23 11:05:49 2009
New Revision: 39077
URL: https://trac.parrot.org/parrot/changeset/39077

Log:
[GC] Plugged a memory leak of the initial context allocated; its reference
count is wrong, so it could never get recycled to the free list.  This is a
workaround and slightly ugly, but context reference counting is on the axe
list.

Modified:
   trunk/src/gc/alloc_register.c

Modified: trunk/src/gc/alloc_register.c
==============================================================================
--- trunk/src/gc/alloc_register.c	Sat May 23 10:38:31 2009	(r39076)
+++ trunk/src/gc/alloc_register.c	Sat May 23 11:05:49 2009	(r39077)
@@ -163,7 +163,13 @@
 
     while (context) {
         Parrot_Context * const prev = context->caller_ctx;
+
+        /* always collect the parentmost context in the parentmost interp*/
+        if (!prev && !interp->parent_interpreter)
+            context->ref_count = 1;
+
         Parrot_free_context(interp, context, 1);
+
         context = prev;
     }
 
@@ -569,6 +575,7 @@
 #endif
         ctx->ref_count--;
     }
+
     if (ctx->ref_count <= 0) {
         void *ptr;
         int slot;


More information about the parrot-commits mailing list