[Mono-bugs] [Bug 59509][Nor] New - Can't catch OutOfMemoryException for multiple dimension arrays

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 2 Jun 2004 21:11:28 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=59509

--- shadow/59509	2004-06-02 21:11:28.000000000 -0400
+++ shadow/59509.tmp.3366	2004-06-02 21:11:28.000000000 -0400
@@ -0,0 +1,63 @@
+Bug#: 59509
+Product: Mono: Runtime
+Version: unspecified
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: sebastien@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Can't catch OutOfMemoryException for multiple dimension arrays
+
+Description of Problem:
+Can't catch OutOfMemoryException for multiple dimension arrays.
+
+Steps to reproduce the problem:
+1. Compile the attached source.
+   mcs outofmem.cs
+
+2. Execute it.
+   mono outofmem.exe
+
+
+Actual Results (mono):
+new int [Int32.MaxValue]
+1- OoM System.OutOfMemoryException: Out of memory
+in (unmanaged) (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
+in <0x00004> (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
+in <0x0004b> OutOfMem:Main ()
+ 
+new int [Int32.MaxValue, Int32.MaxValue]
+ 
+Unhandled Exception: System.OutOfMemoryException: Out of memory
+in (unmanaged) (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
+in <0x00004> (wrapper managed-to-native)
+System.Object:__icall_wrapper_mono_array_new_specific (intptr,int)
+in <0x0004b> OutOfMem:Main ()
+
+
+Expected Results (ms runtime):
+new int [Int32.MaxValue]
+1- OoM System.OutOfMemoryException: Out of memory
+ 
+new int [Int32.MaxValue, Int32.MaxValue]
+2- OoM System.OutOfMemoryException: Out of memory
+
+
+How often does this happen? 
+Always.
+
+
+Additional Information:
+The exception is thrown from the runtime (/mono/mono/metadata/object.c) but
+I don't see why one can be catched, while the second cannot.