[svn:parrot] r48622 - in trunk: include/parrot src/string

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Tue Aug 24 13:32:24 UTC 2010


Author: nwellnhof
Date: Tue Aug 24 13:32:23 2010
New Revision: 48622
URL: https://trac.parrot.org/parrot/changeset/48622

Log:
Clear the live flag on copied strings

This was another cause of strings not getting collected early enough.
I think the handling of flags in str_copy and str_clone still needs some
auditing. Also fix a glaring, but probably harmless error in PObj_gc_CLEAR.

Modified:
   trunk/include/parrot/pobj.h
   trunk/src/string/api.c

Modified: trunk/include/parrot/pobj.h
==============================================================================
--- trunk/include/parrot/pobj.h	Tue Aug 24 12:40:53 2010	(r48621)
+++ trunk/include/parrot/pobj.h	Tue Aug 24 13:32:23 2010	(r48622)
@@ -328,8 +328,8 @@
 
 #define PObj_gc_CLEAR(o) (PObj_get_FLAGS(o) \
     &= ~PObj_custom_destroy_FLAG \
-     | ~PObj_custom_mark_FLAG \
-     | ~PObj_live_FLAG)
+     & ~PObj_custom_mark_FLAG \
+     & ~PObj_live_FLAG)
 
 #endif /* PARROT_POBJ_H_GUARD */
 

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Tue Aug 24 12:40:53 2010	(r48621)
+++ trunk/src/string/api.c	Tue Aug 24 13:32:23 2010	(r48622)
@@ -389,8 +389,12 @@
 
     d = Parrot_gc_new_string_header(interp,
         PObj_get_FLAGS(s) & ~PObj_constant_FLAG);
+    /* This overwrites the constant flag again. Not sure if this is OK */
     STRUCT_COPY(d, s);
 
+    /* Clear live flag. It might be set on constant strings */
+    PObj_live_CLEAR(d);
+
     /* Now check that buffer allocated from pool and affected by compacting */
     if (is_movable && Buffer_bufstart(s)) {
         /* If so, mark it as shared */


More information about the parrot-commits mailing list