[svn:parrot] r44228 - branches/sys_mem_reduce/src/gc

bacek at svn.parrot.org bacek at svn.parrot.org
Sat Feb 20 12:17:14 UTC 2010


Author: bacek
Date: Sat Feb 20 12:17:13 2010
New Revision: 44228
URL: https://trac.parrot.org/parrot/changeset/44228

Log:
Initialize initial "re"allocation with zeroes in GC MS to prevent epic failures due uninitialized memory.

Modified:
   branches/sys_mem_reduce/src/gc/gc_ms.c

Modified: branches/sys_mem_reduce/src/gc/gc_ms.c
==============================================================================
--- branches/sys_mem_reduce/src/gc/gc_ms.c	Sat Feb 20 11:42:53 2010	(r44227)
+++ branches/sys_mem_reduce/src/gc/gc_ms.c	Sat Feb 20 12:17:13 2010	(r44228)
@@ -1127,7 +1127,16 @@
 gc_ms_reallocate_memory_chunk(PARROT_INTERP, ARGIN(void *data), size_t newsize)
 {
     ASSERT_ARGS(gc_ms_allocate_memory_chunk)
-    return mem_internal_realloc(data, newsize);
+    /* FIXME Apparently many parts of Parrot depends on initial initialization
+     * of "re"allocated chunk with zeroes. E.g. PackFiles and FIA. */
+    if (!data) {
+        data = mem_internal_allocate(newsize);
+        memset(data, 0, newsize);
+        return data;
+    }
+    else {
+        return mem_internal_realloc(data, newsize);
+    }
 }
 
 static void *


More information about the parrot-commits mailing list