[svn:parrot] r40885 - branches/pluggable_runcore/src/runcore

cotto at svn.parrot.org cotto at svn.parrot.org
Mon Aug 31 02:32:45 UTC 2009


Author: cotto
Date: Mon Aug 31 02:32:43 2009
New Revision: 40885
URL: https://trac.parrot.org/parrot/changeset/40885

Log:
[profiling] put profile_filename in the root set so it won't get collected until the interp exits.
The cast from STRING* to PMC* is ugly, but gc_register_pmc works for any PObj.

Modified:
   branches/pluggable_runcore/src/runcore/cores.c

Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c	Sun Aug 30 22:30:31 2009	(r40884)
+++ branches/pluggable_runcore/src/runcore/cores.c	Mon Aug 31 02:32:43 2009	(r40885)
@@ -1042,6 +1042,8 @@
     ASSERT_ARGS(init_profiling_core)
 
     runcore->profile_filename = Parrot_sprintf_c(interp, "parrot.%d.pprof", getpid());
+    /* profile_filename gets collected if it's not marked or in the root set. */
+    gc_register_pmc(interp, (PMC *) runcore->profile_filename);
 
     runcore->runops  = (Parrot_runcore_runops_fn_t)  runops_profiling_core;
     runcore->destroy = (Parrot_runcore_destroy_fn_t) destroy_profiling_core;
@@ -1139,11 +1141,6 @@
                     "attempt to access code outside of current code segment");
         }
 
-        /* HACK: profile_filename appears to get prematurely recycled if it's
-         * not marked.  Manually marking it or adding an unused STRING variable
-         * that points at it keeps it from an untimely demise. */
-        Parrot_gc_mark_PObj_alive(interp, (PObj*)runcore->profile_filename);
-
         /* avoid an extra call to Parrot_Context_get_info */
         mem_sys_memcopy(&preop_info, &postop_info, sizeof (Parrot_Context_info));
 


More information about the parrot-commits mailing list