Android内存不足错误

时间:2012-09-03 05:53:00

标签: java android memory

我有一个应用程序需要同步它与Android联系人列表保存的3个数据库表。

我遍历联系人列表,并为返回的每一行创建一个自定义对象,并将这些对象属性与我在该联系人的应用表中存储的内容进行比较。

此任务在异步任务中执行。

第一次运行时它对我来说很好,但如果我离开应用程序并多次返回它会中断并返回以下错误。有什么想法吗?

09-03 06:42:19.070: E/IMemory(31018): cannot dup fd=1023, size=2097152, err=0 (Too many open files)

09-03 06:42:19.070: E/IMemory(31018): cannot map BpMemoryHeap (binder=0x1197738), size=2097152, fd=-1 (Bad file number)

09-03 06:42:19.070: E/JavaBinder(31018): *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)

09-03 06:42:19.070: E/JavaBinder(31018): java.lang.RuntimeException: No memory in memObj
09-03 
06:42:19.070: E/JavaBinder(31018):  at android.database.CursorWindow.native_init(Native Method)
09-03 
06:42:19.070: E/JavaBinder(31018):  at android.database.CursorWindow.<init>(CursorWindow.java:518)
09-03 
06:42:19.070: E/JavaBinder(31018):  at android.database.CursorWindow.<init>(CursorWindow.java:27)
09-03 
06:42:19.070: E/JavaBinder(31018):  at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:493)

09-03 06:42:19.070: E/JavaBinder(31018):    at android.database.CursorWindow$1.createFromParcel(CursorWindow.java:496)
09-03 06:42:19.070: E/JavaBinder(31018):    at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:103)
09-03 06:42:19.070: E/JavaBinder(31018):    at android.os.Binder.execTransact(Binder.java:288)
09-03 06:42:19.070: E/JavaBinder(31018):    at dalvik.system.NativeStart.run(Native Method)

1 个答案:

答案 0 :(得分:1)

E/IMemory(31018): cannot dup fd=1023, size=2097152, err=0 (Too many open files)

android.database.CursorWindow.native_init(Native Method)

这两行表明你正在用游标搞乱一些东西,比如不关闭等等,

我建议正确关闭所有游标并观察app的行为。