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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Fri May 29 09:52:20 UTC 2009


Author: chromatic
Date: Fri May 29 09:52:20 2009
New Revision: 39234
URL: https://trac.parrot.org/parrot/changeset/39234

Log:
[PMC] Plugged the memory leak of a Parrot_cont in the destination PMC returned
from Continuation's clone().

Modified:
   trunk/src/pmc/continuation.pmc

Modified: trunk/src/pmc/continuation.pmc
==============================================================================
--- trunk/src/pmc/continuation.pmc	Fri May 29 09:43:49 2009	(r39233)
+++ trunk/src/pmc/continuation.pmc	Fri May 29 09:52:20 2009	(r39234)
@@ -134,11 +134,17 @@
 */
 
     VTABLE PMC *clone() {
-        Parrot_cont * const cc_self = PMC_cont(SELF);
-        Parrot_cont * const cc      = new_continuation(INTERP, cc_self);
-        PMC         * const ret     = pmc_new(INTERP, enum_class_Continuation);
+        Parrot_cont * const cc_self  = PMC_cont(SELF);
+        Parrot_cont * const cc       = new_continuation(INTERP, cc_self);
+        PMC         * const ret      = pmc_new(INTERP, enum_class_Continuation);
+        Parrot_cont * const ret_cont = PMC_cont(ret);
 
         PObj_custom_mark_destroy_SETALL(ret);
+
+        /* free ret's PMC_cont */
+        Parrot_free_context(interp, ret_cont->from_ctx, 1);
+        mem_sys_free(ret_cont);
+
         cc->runloop_id = cc_self->runloop_id;
         PMC_cont(ret)  = cc;
 


More information about the parrot-commits mailing list