[Mono-dev] Problem building with big arrays

Neale Ferguson NealeFerguson at verizon.net
Wed Jun 11 00:33:04 UTC 2014


Building from head and using --trace=E

[0x2000028a030:] EXCEPTION handling: System.IndexOutOfRangeException: Array index is out of range.
[0x2000028a030:] EXCEPTION handling: System.TypeInitializationException: An exception was thrown by the type initializer for System.TermInfoDriver
[0x2000028a030:] EXCEPTION handling: System.TypeInitializationException: An exception was thrown by the type initializer for System.ConsoleDriver
[0x2000028a030:] EXCEPTION handling: System.TypeInitializationException: An exception was thrown by the type initializer for System.Console
[0x2000028a030:] EXCEPTION handling: System.IndexOutOfRangeException: Array index is out of range.

Unhandled Exception:
Nested exception detected.
Original Exception: at Mono.CSharp.Driver.Main (string[]) <0x0008a>

Nested exception:at (wrapper stelemref) object.virt_stelemref_object (intptr,object) <0x00044>
at string.Format (string,object,object) <0x00062>
at System.Exception.get_StackTrace () <0x0011c>
at System.Exception.ToString () <0x00230>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>


[ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
Original Exception: at Mono.CSharp.Driver.Main (string[]) <0x0008a>

Nested exception:at (wrapper stelemref) object.virt_stelemref_object (intptr,object) <0x00044>
at string.Format (string,object,object) <0x00062>
at System.Exception.get_StackTrace () <0x0011c>
at System.Exception.ToString () <0x00230>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>
at System.Exception.ToString () <0x0018e>

Using just --trace shows:

0x2000028a030 [ 16] . . . . . . . . . . . . . . . . ENTER: string:ToCharArray () ip: 0x2000066cf80 sp: 0x3ffffd591d8 - this:[STRING:0x20000801ce0:],0x2000028a030 [ 17] . . . . . . . . . . . . . . . . . ENTER: string:ToCharArray (int,int) ip: 0x200007407c0 sp: 0x3ffffd590e8 - this:[STRING:0x20000801ce0:], [INT4:0], [INT4:1],
0x2000028a030 [ 18] . . . . . . . . . . . . . . . . . . ENTER: (wrapper alloc) object:AllocVector (intptr,intptr) ip: 0x2000074095c sp: 0x3ffffd58fb8 - [INTPTR:0x804a9bf8], [INTPTR:0x1],
0x2000028a030 [ 18] . . . . . . . . . . . . . . . . . . LEAVE: (wrapper alloc) object:AllocVector (intptr,intptr)[System.Char[]:0x20000801d00] ip: 0x20000665626
0x2000028a030 [ 18] . . . . . . . . . . . . . . . . . . ENTER: string:CharCopy (char*,char*,int) ip: 0x20000740a0a sp: 0x3ffffd58fb8 - [PTR:(nil)], [PTR:0x20000801cf4], [INT4:1],
0x2000028a030 [ 19] . . . . . . . . . . . . . . . . . . . ENTER: string:memcpy4 (byte*,byte*,int) ip: 0x20000740da0 sp: 0x3ffffd58eb8 - [PTR:(nil)], [PTR:0x20000801cf4], [INT4:2],

With the relevant section being:

                public unsafe char[] ToCharArray (int startIndex, int length)
                {
                        if (startIndex < 0)
                                throw new ArgumentOutOfRangeException ("startIndex", "< 0");
                        if (length < 0)
                                throw new ArgumentOutOfRangeException ("length", "< 0");
                        if (startIndex > this.length - length)
                                throw new ArgumentOutOfRangeException ("startIndex", "Must be greater than the length of the string.");

                        char[] tmp = new char [length];
                        fixed (char* dest = tmp, src = this)
                                CharCopy (dest, src + startIndex, length);
                        return tmp;
                }

Which indicates new char [length] is returning NULL.

Before I trace this any further, is this something that's been seen before with big arrays?

Neale


More information about the Mono-devel-list mailing list