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

cotto at svn.parrot.org cotto at svn.parrot.org
Sun Sep 6 15:25:06 UTC 2009


Author: cotto
Date: Sun Sep  6 15:25:02 2009
New Revision: 41070
URL: https://trac.parrot.org/parrot/changeset/41070

Log:
[profiling] fix an off-by-one bug found by bacek++ which appears to solve the memory corruption bug noted earlier

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

Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c	Sun Sep  6 13:57:25 2009	(r41069)
+++ branches/pluggable_runcore/src/runcore/cores.c	Sun Sep  6 15:25:02 2009	(r41070)
@@ -1099,12 +1099,7 @@
     runcore->profiling_flags = 0;
     runcore->runloop_count   = 0;
     runcore->level           = 0;
-    /* XXX: workaround for a nasty memory corruption bug that prevents the
-     * profiling of Rakudo hello world.  Normally this would be 32, but when
-     * profiling hello world it becomes corrupted when growing to 512.  Setting
-     * it to this value prevents the need for reallocation and avoids exposing
-     * the corruption.  Also, the bug doesn't affect everyone. */
-    runcore->time_size       = 1024;
+    runcore->time_size       = 32;
     runcore->time            = mem_allocate_n_typed(runcore->time_size, UHUGEINTVAL);
     Profiling_first_loop_SET(runcore);
 
@@ -1153,7 +1148,7 @@
         if (runcore->level > runcore->time_size) {
             runcore->time_size *= 2;
             runcore->time =
-                mem_realloc_n_typed(runcore->time, runcore->time_size, UHUGEINTVAL);
+                mem_realloc_n_typed(runcore->time, runcore->time_size+1, UHUGEINTVAL);
         }
 
         /* store the time between DO_OP and the start of this runcore in this


More information about the parrot-commits mailing list