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

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Thu Sep 30 17:55:34 UTC 2010


Author: nwellnhof
Date: Thu Sep 30 17:55:34 2010
New Revision: 49389
URL: https://trac.parrot.org/parrot/changeset/49389

Log:
[gc] Set free list flag after freeing buffer storage

The order is important here. If the free list flag is set too early,
the freed memory isn't accounted for because PObj_is_movable returns
false. Then string buffer memory might not be freed because memory
blocks are considered "almost full".

This should fix TT #1803.

Modified:
   trunk/src/gc/gc_ms2.c

Modified: trunk/src/gc/gc_ms2.c
==============================================================================
--- trunk/src/gc/gc_ms2.c	Thu Sep 30 16:26:26 2010	(r49388)
+++ trunk/src/gc/gc_ms2.c	Thu Sep 30 17:55:34 2010	(r49389)
@@ -814,11 +814,12 @@
         if (PObj_on_free_list_TEST(s))
             return;
         Parrot_list_remove(interp, self->strings, Obj2LLH(s));
-        PObj_on_free_list_SET(s);
 
         if (Buffer_bufstart(s) && !PObj_external_TEST(s))
             Parrot_gc_str_free_buffer_storage(interp, &self->string_gc, (Buffer *)s);
 
+        PObj_on_free_list_SET(s);
+
         Parrot_gc_pool_free(interp, self->string_allocator, Obj2LLH(s));
 
         --interp->gc_sys->stats.header_allocs_since_last_collect;
@@ -1093,11 +1094,12 @@
             PObj_live_CLEAR(obj);
         }
         else if (!PObj_constant_TEST(obj)) {
-            PObj_on_free_list_SET(obj);
             LIST_REMOVE(list, tmp);
 
             callback(interp, obj);
 
+            PObj_on_free_list_SET(obj);
+
             Parrot_gc_pool_free(interp, pool, tmp);
         }
         tmp = next;


More information about the parrot-commits mailing list