English 中文(简体)
Mono Boehm诉SGen GC
原标题:Mono Boehm vs SGen GC

I have an application developed (renamed in my error as MyApplication for privacy) on the following enviroment:

  • Monotouch 2.1
  • MonoDevelop 2.4.2
  • MacOS 10.6.8
  • iOS SDK 4.3

工作罚款。

Now i m try to migrate to iOS 5.0/5.1 and Monotouch 5.2.5 with MonoDevelop 2.8.8.4. My application crashes immediately with the following error:

Stacktrace:

at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication.UIApplicationMain (int,string[],intptr,intptr) <IL 0x0009f, 0xffffffff>
  at MonoTouch.UIKit.UIApplication.Main (string[],string,string) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
  at MonoTouch.UIKit.UIApplication.Main (string[]) [0x00000] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:34
  at MyApplication.Application.Main (string[]) [0x00000] in /Users/MyPC/Projects/Test/MyApplication/Main.cs:19
  at (wrapper runtime-invoke) <Module>.runtime_invoke_void_object (object,intptr,intptr,intptr) <IL 0x00050, 0xffffffff>

土著阶层:

0   MyApplication                            0x000908fc mono_handle_native_sigsegv + 284
1   MyApplication                            0x00005c98 mono_sigsegv_signal_handler + 248
2   libSystem.B.dylib                   0x9138145b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libobjc.A.dylib                     0x02958753 prepareForMethodLookup + 93
5   libobjc.A.dylib                     0x0294f069 lookUpMethod + 86
6   libobjc.A.dylib                     0x0294f1d6 _class_lookupMethodAndLoadCache + 40
7   libobjc.A.dylib                     0x029620e3 objc_msgSend + 87
8   UIKit                               0x01cba799 -[UIControl sendAction:to:forEvent:] + 67
9   UIKit                               0x01cbcc2b -[UIControl(Internal) _sendActionsForEvents:withEvent:] + 527
10  UIKit                               0x01cbba1c -[UIControl touchesBegan:withEvent:] + 277
11  UIKit                               0x01c4ed41 -[UIWindow _sendTouchesForEvent:] + 395
12  UIKit                               0x01c2fc37 -[UIApplication sendEvent:] + 447
13  UIKit                               0x01c34f2e _UIApplicationHandleEvent + 7576
14  GraphicsServices                    0x03fa5992 PurpleEventCallback + 1550
15  CoreFoundation                      0x00df8944 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 52
16  CoreFoundation                      0x00d58cf7 __CFRunLoopDoSource1 + 215
17  CoreFoundation                      0x00d55f83 __CFRunLoopRun + 979
18  CoreFoundation                      0x00d55840 CFRunLoopRunSpecific + 208
19  CoreFoundation                      0x00d55761 CFRunLoopRunInMode + 97
20  GraphicsServices                    0x03fa41c4 GSEventRunModal + 217
21  GraphicsServices                    0x03fa4289 GSEventRun + 115
22  UIKit                               0x01c38c93 UIApplicationMain + 1160
23  ???                                 0x090a61fc 0x0 + 151675388
24  ???                                 0x090a60c8 0x0 + 151675080
25  ???                                 0x090a59c0 0x0 + 151673280
26  ???                                 0x090a590c 0x0 + 151673100
27  ???                                 0x090a5997 0x0 + 151673239
28  MyApplication                            0x0000a002 mono_jit_runtime_invoke + 722
29  MyApplication                            0x00169efe mono_runtime_invoke + 126
30  MyApplication                            0x0016dfe4 mono_runtime_exec_main + 420
31  MyApplication                            0x00173405 mono_runtime_run_main + 725
32  MyApplication                            0x00067205 mono_jit_exec + 149
33  MyApplication                            0x002116d5 main + 2837
34  MyApplication                            0x00003055 start + 53
35  ???                                 0x00000004 0x0 + 4

Got a SIGSEGV while executing native code. This usually indicates a fatal error in the mono runtime or one of the native libraries used by your application.

如果将其部署到SDK 4.3,情况就相同。 I mink it may be a problem with the new GC SGen as referred here

UPDATE:在警示中,事实上有误,显示为1,600。 信息 = “Copy.”

Class Handle: the requested operation cannot be completed because the object has been garbage collected

如何解决这一问题?

最佳回答

在Mono Touch 4中,GC被更积极地执行,以便尽早发现某种类型的方案拟订错误:确保当地物体在GC的早期释放。

最常见的模式是采用一种方法宣布变数:

void Method ()
{
    var view = new UIView ();
    otherNativeObject.NativeProperty = view;
}

这里发生的情况是,经过管理的GC并不认为其他NativeObject提到这一看法,因此,在完成执行方法时,GC将放弃这一看法。 在稍后某个时候,其他NativeObject将试图利用这一看法,而你最终将发生类似于你所报的坠毁事件(确切的 st痕和电文将因接触自由的本土物体而有所不同)。

以上例子的固定之处是容易的,只是使这种观点成为一种类别变数:

UIView view;
void Method ()
{
    view = new UIView ();
    otherNativeObject.NativeProperty = view;
}

现在,在方法退出时,理事会将无法自由发表意见。

请注意,这一坠毁事件在Mono Touch 4中是新的,使GC更具侵略性的后果是,在偷窃时,你会看到这一问题,而不是在(非常随机)坠毁时从你的客户那里听到这个问题。

问题回答

暂无回答




相关问题
What are some things Mono is not a good fit for?

I ve started your typical web project from scratch using the Mono platform. You know, web services, a UI, MySQL database, all that. I ve heard around the net that it s not a picture-perfect ...

How Reliable is Mono on Linux vs .NET on Windows?

I am trying to decide upon using Mono with C# or Python (Django) for a Linux based Web Site. My concern with C# is that Mono may not be as reliable as .NET. Does anyone have any experience with this?

System.Data in Mono

Has System.Data in Mono been expanded to include extra functionality? I m attempting to make use of the SQL Parser written for Mono in Mono.Data.SqlExpressions but when all the classes in the ...

Basic MEF workflow/usage

I m looking to a framework which will allow me to have a simple plugin system in my .NET application. It seems MEF is the framework which Microsoft is endorsing, and will become part of .NET 4 (it ...

In Mono/Gnome, how can I look up the icon for a mime type?

Gnome.Icon and Gnome.ThumbnailFactory both want me to pass in a URI of a file whose icon I want -- I only have a MIME type, which I want to look up an icon for. Is there a GNOME C# API function which ...

ASP.NET MVC 2 on mono

Is it possible to run the new ASP.NET MVC 2 Preview 2 on mono?

热门标签