From: Miguel de Icaza Date: Mon, 7 Aug 2006 22:16:58 +0000 (-0000) Subject: Add support for arrays X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=dbe5a0257c713fbfdea697244d0df96f9b1d2ed8;p=mono.git Add support for arrays svn path=/trunk/mono/; revision=63458 --- diff --git a/samples/size/sample.cs b/samples/size/sample.cs index 5a874dec852..e5da814435b 100644 --- a/samples/size/sample.cs +++ b/samples/size/sample.cs @@ -20,4 +20,10 @@ class Demo { class DD { Demo d = new Demo (); object [] o = new object [10]; + + public DD () + { + o [0] = new Demo (); + o [5] = new Demo (); + } } diff --git a/samples/size/size.c b/samples/size/size.c index a3d2253add1..94174ba0a65 100644 --- a/samples/size/size.c +++ b/samples/size/size.c @@ -41,7 +41,16 @@ memory_usage (MonoObject *this, GHashTable *visited) break; case MONO_TYPE_SZARRAY: - printf ("implement me\n"); + { + int len, i; + mono_field_get_value (this, field, &value); + len = mono_array_length ((MonoArray *)value); + for (i = 0; i < len; i++){ + MonoObject *item = mono_array_get ((MonoArray *) value, gpointer, i); + if (item != NULL) + total += memory_usage (item, visited); + } + } break; case MONO_TYPE_I4: