不時在某個特定時刻,我的應用程序會壓縮此消息。
Mprotect failed at 0x4f2f000 (length 12288) with errno 12
Stacktrace:
at Mono.Data.Sqlite.SqliteConvert.UTF8ToString (intptr,int) <0x000af>
at Mono.Data.Sqlite.SQLite3.GetText (Mono.Data.Sqlite.SqliteStatement,int) <0x00037>
at Mono.Data.Sqlite.SQLite3.GetValue (Mono.Data.Sqlite.SqliteStatement,int,Mono.Data.Sqlite.SQLiteType) <0x0047b>
at Mono.Data.Sqlite.SqliteDataReader.GetValue (int) <0x0009f>
at Mono.Data.Sqlite.SqliteDataReader.GetValues (object[]) <0x00057>
at TestLibertatea2.LocalDb.Query (string,Mono.Data.Sqlite.SqliteParameter[]) [0x0008c] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Backend/Database/LocalDb.cs:68
at TestLibertatea2.LocalDb.QueryAsList (string,string,Mono.Data.Sqlite.SqliteParameter[]) [0x00006] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Backend/Database/LocalDb.cs:85
at TestLibertatea2.LocalDb.QueryAsList (string,string) [0x00000] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Backend/Database/LocalDb.cs:79
at TestLibertatea2.DbArticol.GetDbList (string) [0x00006] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Backend/DbArticol.cs:37
at TestLibertatea2.HomePage.loadData() [0x00048] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Controllers/HomePage.cs:105
at TestLibertatea2.HomePage.<ViewDidAppear>m__5() [0x00000] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Controllers/HomePage.cs:76
at MonoTouch.Foundation.NSActionDispatcher.Apply() <0x0002b>
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
at MonoTouch.UIKit.UIApplication.Main (string[],string,string) <0x000cf>
at MonoTouch.UIKit.UIApplication.Main (string[]) <0x00023>
at TestLibertatea2.Application.Main (string[]) [0x00000] in /Users/admin/Projects/TestLibertatea2/TestLibertatea2/Main.cs:17
at (wrapper runtime-invoke) object.runtime_invoke_dynamic (intptr,intptr,intptr,intptr) <0xffffffff>
本地堆棧跟蹤:
0 TestLibertatea2 0x005bc51c mono_handle_native_sigsegv + 412
1 TestLibertatea2 0x005e3708 sigabrt_signal_handler + 148
2 libsystem_c.dylib 0x36aeb72f _sigtramp + 42
3 libsystem_c.dylib 0x36ae03bb pthread_kill + 58
4 libsystem_c.dylib 0x36ad8bff abort + 78
5 TestLibertatea2 0x0070f044 GC_remap + 200
6 TestLibertatea2 0x00702a28 GC_allochblk_nth + 1536
7 TestLibertatea2 0x007023d8 GC_allochblk + 96
8 TestLibertatea2 0x00708d0c GC_alloc_large + 92
9 TestLibertatea2 0x007093b0 GC_generic_malloc + 324
10 TestLibertatea2 0x00709690 GC_malloc_atomic + 332
11 TestLibertatea2 0x00695ab0 mono_object_allocate_ptrfree + 64
12 TestLibertatea2 0x00695c1c mono_array_new_specific + 148
13 TestLibertatea2 0x0050f34c wrapper_managed_to_native_object___icall_wrapper_mono_array_new_specific_intptr_int + 68
14 TestLibertatea2 0x00349e30 Mono_Data_Sqlite_SQLite3_GetText_Mono_Data_Sqlite_SqliteStatement_int + 56
15 TestLibertatea2 0x0034ac10 Mono_Data_Sqlite_SQLite3_GetValue_Mono_Data_Sqlite_SqliteStatement_int_Mono_Data_Sqlite_SQLiteType + 1148
16 TestLibertatea2 0x00361f90 Mono_Data_Sqlite_SqliteDataReader_GetValue_int + 160
17 TestLibertatea2 0x00361ff4 Mono_Data_Sqlite_SqliteDataReader_GetValues_object__ + 88
18 TestLibertatea2 0x001a01e8 TestLibertatea2_LocalDb_Query_string_Mono_Data_Sqlite_SqliteParameter__ + 1288
19 TestLibertatea2 0x001a0704 TestLibertatea2_LocalDb_QueryAsList_string_string_Mono_Data_Sqlite_SqliteParameter__ + 256
20 TestLibertatea2 0x001a05b8 TestLibertatea2_LocalDb_QueryAsList_string_string + 200
21 TestLibertatea2 0x001bca90 TestLibertatea2_DbArticol_GetDbList_string + 304
22 TestLibertatea2 0x0018b494 TestLibertatea2_HomePage_loadData + 516
23 TestLibertatea2 0x0018cdc8 TestLibertatea2_HomePage__ViewDidAppearm__5 + 128
24 TestLibertatea2 0x0005f3bc MonoTouch_Foundation_NSActionDispatcher_Apply + 44
25 TestLibertatea2 0x0050a498 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
26 TestLibertatea2 0x005a2064 mono_jit_runtime_invoke + 2800
27 TestLibertatea2 0x00690d38 mono_runtime_invoke + 140
28 TestLibertatea2 0x00716928 monotouch_trampoline + 2840
29 Foundation 0x35dca7cd __NSFireTimer + 136
30 CoreFoundation 0x33538a47 __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__ + 14
31 CoreFoundation 0x3353aecb __CFRunLoopDoTimer + 850
32 CoreFoundation 0x3353b845 __CFRunLoopRun + 1088
33 CoreFoundation 0x334cbec3 CFRunLoopRunSpecific + 230
34 CoreFoundation 0x334cbdcb CFRunLoopRunInMode + 58
35 GraphicsServices 0x3639641f GSEventRunModal + 114
36 GraphicsServices 0x363964cb GSEventRun + 62
37 UIKit 0x330e8d69 -[UIApplication _run] + 404
38 UIKit 0x330e6807 UIApplicationMain + 670
39 TestLibertatea2 0x0008c6fc wrapper_managed_to_native_MonoTouch_UIKit_UIApplication_UIApplicationMain_int_string___intptr_intptr + 240
40 TestLibertatea2 0x0006af20 MonoTouch_UIKit_UIApplication_Main_string__ + 36
41 TestLibertatea2 0x001847c8 TestLibertatea2_Application_Main_string__ + 128
42 TestLibertatea2 0x0050a498 wrapper_runtime_invoke_object_runtime_invoke_dynamic_intptr_intptr_intptr_intptr + 200
43 TestLibertatea2 0x005a2064 mono_jit_runtime_invoke + 2800
44 TestLibertatea2 0x00690d38 mono_runtime_invoke + 140
45 TestLibertatea2 0x00693ce8 mono_runtime_exec_main + 784
46 TestLibertatea2 0x00692d4c mono_runtime_run_main + 1048
47 TestLibertatea2 0x005a9814 mono_jit_exec + 216
48 TestLibertatea2 0x0059c620 main + 3616
49 TestLibertatea2 0x000024a0 start + 52
從GDB調試信息:
我該如何測試自己的記憶?我在我的導航控制器中使用了一個計時器。NSTimer.CreateRepeatingScheduledTimer(new TimeSpan(0,0,1),delegate {}} Console.WriteLine(String.Format(「Mem:{0:0,0}」,GC.GetTotalMemory(假))); }); 而且一切看起來都很好,內存不會變得不尋常,而且會被丟棄。 – Daniel
「一個數字,是目前在託管內存中分配的字節數的最佳可用近似值。」關鍵字是「近似」和「管理」(堆棧中的最後一次調用,使用IntPtr,可能代表非託管內存)。參考:http://msdn.microsoft.com/en-us/library/system.gc.gettotalmemory.aspx您是否嘗試覆蓋ReceiveMemoryWarning(如第二個鏈接中所建議的)? – poupou
是的,我重寫了ReceiveMemoryWarning,它從來沒有被調用......這是奇怪的 - 在模擬器上,當我改變當前的UIViewController時,內存不會增長,但在實際的ipad設備上,內存在增長,這個視圖的變化會出現崩潰。 – Daniel