[Mono-devel-list] string corruption

Paolo Molaro lupus at ximian.com
Thu Feb 19 13:46:33 EST 2004


On 02/19/04 Dale Olds wrote:
> I have been seeing some strange behavior with strings apparently
> forgetting their values, and have distilled it down to the attached test
> case. The test case involves nested value types that have a reference
> type member, though I'm not sure that is directly related to the
> problem. The test case succeeds if the the call to GC.Collect() is
> removed.
[...]
> Any ideas? I am not currently running on a build from CVS, but can do so
> if it would help to further test this.

The issue was still present in cvs, but it's fixed now. Thanks for the
nice bug report with test case.
The included patch should apply to any recent mono version if you're not
tracking cvs.

lupus

-- 
-----------------------------------------------------------------
lupus at debian.org                                     debian/rules
lupus at ximian.com                             Monkeys do it better

Index: object.c
===================================================================
RCS file: /cvs/public/mono/mono/metadata/object.c,v
retrieving revision 1.201
retrieving revision 1.202
diff -u -p -r1.201 -r1.202
--- object.c	18 Feb 2004 15:43:44 -0000	1.201
+++ object.c	19 Feb 2004 18:16:59 -0000	1.202
@@ -307,7 +307,7 @@ mono_class_compute_gc_descriptor (MonoCl
 				MonoClass *fclass = field->type->data.klass;
 				if (!fclass->enumtype) {
 					mono_class_compute_gc_descriptor (fclass);
-					bitmap |= (fclass->gc_bitmap & ~2) << pos;
+					bitmap |= (fclass->gc_bitmap >> (sizeof (MonoObject) / sizeof (gpointer))) << pos;
 				}
 				break;
 			}



More information about the Mono-devel-list mailing list