android - 'Too many open files' error -


In my app, there is an inclusive operation on form submissions. In most cases the inclusion campaign is successful. Sometimes the entry is not operational and then, it is giving java.lang.RuntimeException . Here is the logbat description:

  03-28 10: 52: 09.260: error / costume (1501): can not FD = 1023, size = 1048576, err = 0 (too much Open files) October 03-28: 52: 9.260: Error / IMemory (1501): 52: 9.260: error / BpMemoryHeap (binder = 0x5919b0), size = 1048576, fd = -1 (bad file number ) Can not map to 03-28 October JavaBinder (1501): *** Unwanted remote exception! (Exceptions are not yet supported in the processes.) 03-28 10: 52: 09.260: Error / JavaBinder (1501): java.lang.RuntimeException: Memory memobb 03-28 10: 52: 09.260: Error / JavaBinder (1501): android.database.CursorWindow.native_init (Native Method) on 03-28 October: 52: 09.260: Error / JavaBinder (1501):. Android.database.CursorWindow & lt; Init & gt; (CursorWindow.java Peters18) 03- 28 10: 52: 9.260: Error / JavaBinder (1501): android.database.CursorWindow & lt; Init & gt; (CursorWindow.java:27) October 03-28:. 52: 9.260: Error / JavaBinder (1501): .database.CursorWindow $ 1.createFromParcel (CursorWindow.java:493) on October 03-28: 52: 09.260: Error / JavaBinder (1501): android $ 1.createFromParcel at database.CursorWindow (CursorWindow.java:496) October 03-28: 52: 09.260: Error / JavaBinder (1501): 52: android.content.ContentProviderNative.onTransact (ContentProviderNative.java:96) 3 -October 29.260: Error / JavaBinder (1501): on android.os.Binder ExecTransact (Binder.Java: 287) 03-28 10: 52: 09.260: Error / Javabinder (1501): What is the problem with my code in Dalvik.system.Nativ   

Many times (such as trojo phoe has been suggested) are these kinds of problems because the cursor is still I have found that I can try using most problems / ending codebals at the end.

  cursor cursor = null; Try {cursor = db.insert (...); More code here} Finally {if (cursor! = Null) {cursor.close (); Cursor = null; }}   

This ensures that the cursor will always be closed, no matter what.

Comments