解决android项目系统崩溃:Exceptions are not yet supported across processes.

目前在开发一个android项目,其中有一个功能是读取联系人。我是一次性的联系人全部读出来,当联系人数量较少时,几十条,没有问题,超过200条时,则遇到问题是:项目每开启二次,就会崩溃一次,然后就这样下去。这个问题已经存在了好久,就是找不到症结。主要抛出的异常信息为: [color=red]ERROR/JavaBinder(3438): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
ERROR/JavaBinder(3438): java.lang.RuntimeException: No memory in memObj[/color]
部分日志信息显示如下:

12-06 10:14:33.825: INFO/ActivityManager(148): Starting activity: Intent { cmp=com.justel.activity/.ContactShowActivity (has extras) }
12-06 10:14:34.476: DEBUG/dalvikvm(16889): GC_EXPLICIT freed 3976 objects / 151640 bytes in 36ms
12-06 10:14:34.595: DEBUG/dalvikvm(148): GC_EXPLICIT freed 4323 objects / 204992 bytes in 106ms
12-06 10:14:34.775: DEBUG/dalvikvm(3438): GC_EXPLICIT freed 2906 objects / 142256 bytes in 50ms
12-06 10:14:34.895: ERROR/IMemory(3438): cannot dup fd=1023, size=1048576, err=0 (Too many open files)
12-06 10:14:34.895: ERROR/IMemory(3438): cannot map BpMemoryHeap (binder=0x356890), size=1048576, fd=-1 (Bad file number)
12-06 10:14:34.895: ERROR/JavaBinder(3438): *** Uncaught remote exception! (Exceptions are not yet supported across processes.)
12-06 10:14:34.895: ERROR/JavaBinder(3438): java.lang.RuntimeException: No memory in memObj
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.database.CursorWindow.native_init(Native Method)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.database.CursorWindow.(CursorWindow.java:518)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.database.CursorWindow.(CursorWindow.java:27)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:493)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:496)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:108)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at android.os.Binder.execTransact(Binder.java:288)
12-06 10:14:34.895: ERROR/JavaBinder(3438): at dalvik.system.NativeStart.run(Native Method)
12-06 10:14:38.855: WARN/ResourceType(148): Skipping entry 0x7f040000 in package table 0 because it is not complex!
12-06 10:14:38.865: WARN/ResourceType(148): Skipping entry 0x7f040001 in package table 0 because it is not complex!
12-06 10:14:43.835: WARN/ActivityManager(148): Launch timeout has expired, giving up wake lock!
12-06 10:14:43.868: WARN/ActivityManager(148): Activity idle timeout for HistoryRecord{465eb1a0 com.justel.activity/.ContactShowActivity}
12-06 10:14:48.945: DEBUG/dalvikvm(12927): GC_EXPLICIT freed 339 objects / 22016 bytes in 75ms
12-06 10:14:55.565: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 4->3
12-06 10:15:01.565: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 3->4
12-06 10:15:15.645: DEBUG/dalvikvm(396): GC_EXPLICIT freed 3326 objects / 229504 bytes in 81ms
12-06 10:15:16.665: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21567 objects / 524416 bytes in 56ms
12-06 10:15:21.655: DEBUG/dalvikvm(344): GC_EXPLICIT freed 1898 objects / 291336 bytes in 81ms
12-06 10:15:21.655: DEBUG/NativeCrypto(344): Freeing OpenSSL session
12-06 10:15:25.565: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 4->3
12-06 10:15:30.656: DEBUG/dalvikvm(14162): GC_EXPLICIT freed 6797 objects / 367488 bytes in 80ms
12-06 10:15:32.076: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 3->4
12-06 10:15:43.175: DEBUG/dalvikvm(16681): GC_EXPLICIT freed 1577 objects / 101992 bytes in 88ms
12-06 10:15:46.825: DEBUG/HtcLockScreen(148): onRefreshBatteryInfo showBatteryInfo:truepluggedIn:truebatteryLevel:83
12-06 10:15:46.825: DEBUG/HtcLockScreen(148): onRefreshBatteryInfo currentData mPluggedIn:truemBatteryLevel:82
12-06 10:15:46.825: INFO/HtcLockScreen(148): updateStatusViewByPriority, mIsSimCheckView = false, mIsBatteryInfo = false, mIsMusicPlaying = false, mIsAirPlaneMode = false
12-06 10:15:46.835: INFO/global(148): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-06 10:15:46.835: INFO/global(148): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-06 10:15:46.845: DEBUG/BatteryService(148): isUsbConnected() = true
12-06 10:15:46.845: DEBUG/BatteryService(148): mPlugType = 2
12-06 10:15:46.865: ERROR/Tethering(148): attempting to remove unknown iface (usb0), ignoring
12-06 10:15:46.865: DEBUG/WifiService(148): ACTION_BATTERY_CHANGED pluggedType: 2
12-06 10:15:46.875: DEBUG/UsbConnectedReceiver(396): action = psclient.intent.action.usb_status
12-06 10:15:46.875: INFO/fdhttpd(16828): battery level:83 plugged:2
12-06 10:15:46.875: DEBUG/nicolas(16828): onUsbChange
12-06 10:15:46.875: DEBUG/nicolas(16828): 2
12-06 10:15:46.875: DEBUG/nicolas(16828): Begin onReceive->_startService
12-06 10:15:46.875: DEBUG/nicolas(16828): End onReceive->_startService
12-06 10:15:46.875: DEBUG/UsbConnectedReceiver(396): ACTION_BATTERY_CHANGED
12-06 10:15:46.875: DEBUG/UsbConnectedReceiver(396): usbCurrentType = 2
12-06 10:15:46.875: DEBUG/UsbConnectedReceiver(396): Current type is same as previous, return!
12-06 10:16:00.166: DEBUG/PowerManagerService(148): New lightsensor value:90, lcdValue:160
12-06 10:16:04.196: DEBUG/PowerManagerService(148): New lightsensor value:40, lcdValue:160
12-06 10:16:07.135: DEBUG/dalvikvm(16691): GC_EXPLICIT freed 4978 objects / 277200 bytes in 61ms
12-06 10:16:12.165: DEBUG/dalvikvm(586): GC_EXPLICIT freed 347 objects / 13256 bytes in 98ms
12-06 10:16:19.215: DEBUG/dalvikvm(277): GC_EXPLICIT freed 5022 objects / 385392 bytes in 130ms
12-06 10:16:20.385: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21574 objects / 524128 bytes in 68ms
12-06 10:16:53.085: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 4->3
12-06 10:17:02.086: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 3->4
12-06 10:17:24.076: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21574 objects / 524312 bytes in 77ms
12-06 10:17:58.736: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 4->3
12-06 10:18:04.745: INFO/BatteryStatsImpl(148): notePhoneSignalStrengthLocked: 3->4
12-06 10:18:18.886: DEBUG/dalvikvm(277): GC_EXPLICIT freed 1752 objects / 102696 bytes in 138ms
12-06 10:18:27.485: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21561 objects / 524288 bytes in 87ms
12-06 10:19:30.795: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21579 objects / 524256 bytes in 70ms
12-06 10:20:00.115: DEBUG/HtcLockScreen(148): onRefreshBatteryInfo showBatteryInfo:truepluggedIn:truebatteryLevel:84
12-06 10:20:00.115: DEBUG/HtcLockScreen(148): onRefreshBatteryInfo currentData mPluggedIn:truemBatteryLevel:83
12-06 10:20:00.115: INFO/HtcLockScreen(148): updateStatusViewByPriority, mIsSimCheckView = false, mIsBatteryInfo = false, mIsMusicPlaying = false, mIsAirPlaneMode = false
12-06 10:20:00.125: INFO/global(148): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-06 10:20:00.135: INFO/global(148): Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
12-06 10:20:00.145: DEBUG/BatteryService(148): isUsbConnected() = true
12-06 10:20:00.145: DEBUG/BatteryService(148): mPlugType = 2
12-06 10:20:00.145: INFO/fdhttpd(16828): battery level:84 plugged:2
12-06 10:20:00.255: DEBUG/dalvikvm(148): JIT code cache reset in 8 ms (1048488 bytes 28/0)
12-06 10:20:00.265: DEBUG/dalvikvm(148): GC_FOR_MALLOC freed 29488 objects / 1394608 bytes in 118ms
12-06 10:20:00.265: ERROR/Tethering(148): attempting to remove unknown iface (usb0), ignoring
12-06 10:20:00.275: DEBUG/WifiService(148): ACTION_BATTERY_CHANGED pluggedType: 2
12-06 10:20:00.355: DEBUG/nicolas(16828): onUsbChange
12-06 10:20:00.365: DEBUG/UsbConnectedReceiver(396): action = psclient.intent.action.usb_status
12-06 10:20:00.395: DEBUG/nicolas(16828): 2
12-06 10:20:00.395: DEBUG/nicolas(16828): Begin onReceive->_startService
12-06 10:20:00.405: DEBUG/nicolas(16828): End onReceive->_startService
12-06 10:20:00.405: DEBUG/UsbConnectedReceiver(396): ACTION_BATTERY_CHANGED
12-06 10:20:00.405: DEBUG/UsbConnectedReceiver(396): usbCurrentType = 2
12-06 10:20:00.416: DEBUG/UsbConnectedReceiver(396): Current type is same as previous, return!
12-06 10:20:06.885: DEBUG/dalvikvm(277): GC_EXPLICIT freed 997 objects / 68104 bytes in 121ms
12-06 10:20:34.536: DEBUG/dalvikvm(3450): GC_FOR_MALLOC freed 21563 objects / 524248 bytes in 82ms
12-06 10:20:51.525: DEBUG/AndroidRuntime(16889): Shutting down VM
12-06 10:20:51.535: WARN/dalvikvm(16889): threadid=1: thread exiting with uncaught exception (group=0x400259f8)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): FATAL EXCEPTION: main
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.justel.activity/com.justel.activity.ContactShowActivity}: java.lang.NullPointerException: println needs a message
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2787)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2803)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.app.ActivityThread.access$2300(ActivityThread.java:135)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2136)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.os.Handler.dispatchMessage(Handler.java:99)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.os.Looper.loop(Looper.java:144)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at android.app.ActivityThread.main(ActivityThread.java:4937)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at java.lang.reflect.Method.invokeNative(Native Method)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at java.lang.reflect.Method.invoke(Method.java:521)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
12-06 10:20:51.595: ERROR/AndroidRuntime(16889): at dalvik.system.NativeStart.main(Native Method)

[color=red]看来是内存泄漏了,可就找不到问题出在哪里。怀疑是查询sqlite数据库时没有关闭Cursor,看了下代码Cursor是在finally{}代码块中关闭的,没问题。问题究竟出在哪里,后来通过仔细查看代码,原来我在查询联系人时用了两层游标,我只关闭了外层游标,没有关闭里层的,导致内存资源没有被释放。多次运行后,系统资源被耗尽。[/color]

你可能感兴趣的:(android)