java - H2 Database OutOfMemoryError on android? -
i'm trying using h2 on android app 1 of main table is:
create table if not exists " + "tbl_content(" + "date date primary key, " + "content other);
when i'm adding data it, after insert data table below error:
change code many times(change read file, split file , so...) nothing change , every time error again , again: java.lang.outofmemoryerror: capacity:
i add android:largeheap="true"
manifest file nothing change!!!
03-28 15:46:44.786 9512-11006/? d/dalvikvm﹕ gc_before_oom freed 81k, 27% free 12064k/16316k, paused 84ms, total 85ms 03-28 15:46:44.786 9512-11006/? e/dalvikvm-heap﹕ out of memory on 2097168-byte allocation. 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ "mvstore background writer nio:/data/data/com.example.me/files/dbx.mv.db" daemon prio=5 tid=14 runnable 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ | group="main" scount=0 dscount=0 obj=0xb4fbe238 self=0xb8714e70 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ | systid=11006 nice=0 sched=0/0 cgrp=apps handle=-1200532792 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ | state=r schedstat=( 4230000000 770000000 168 ) utm=412 stm=11 core=0 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ @ java.nio.bytebuffer.allocate(bytebuffer.java:~56) 03-28 15:46:44.796 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.writebuffer.grow(writebuffer.java:308) 03-28 15:46:44.816 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.writebuffer.ensurecapacity(writebuffer.java:295) 03-28 15:46:44.816 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.writebuffer.put(writebuffer.java:157) 03-28 15:46:44.816 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.db.valuedatatype.writevalue(valuedatatype.java:289) 03-28 15:46:44.826 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.db.valuedatatype.writevalue(valuedatatype.java:381) 03-28 15:46:44.826 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.db.valuedatatype.write(valuedatatype.java:189) 03-28 15:46:44.826 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.db.transactionstore$versionedvaluetype.write(transactionstore.java:1695) 03-28 15:46:44.826 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.page.write(page.java:737) 03-28 15:46:44.826 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.page.writeunsavedrecursive(page.java:818) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.page.writeunsavedrecursive(page.java:824) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.mvstore.storenowtry(mvstore.java:1060) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.mvstore.storenow(mvstore.java:976) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.mvstore.commitandsave(mvstore.java:965) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.mvstore.writeinbackground(mvstore.java:2373) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ @ org.h2.mvstore.mvstore$backgroundwriterthread.run(mvstore.java:2586) 03-28 15:46:44.836 9512-11006/? i/dalvikvm﹕ [ 03-28 15:46:44.836 9512:11006 w/dalvikvm ] threadid=14: thread exiting uncaught exception (group=0xb4aaaba8) 03-28 15:46:44.866 9512-11006/? e/androidruntime﹕ fatal exception: mvstore background writer nio:/data/data/com.example.me/files/dbx.mv.db process: com.example.me, pid: 9512 java.lang.outofmemoryerror: capacity: 2097152 @ org.h2.mvstore.writebuffer.grow(writebuffer.java:310) @ org.h2.mvstore.writebuffer.ensurecapacity(writebuffer.java:295) @ org.h2.mvstore.writebuffer.put(writebuffer.java:157) @ org.h2.mvstore.db.valuedatatype.writevalue(valuedatatype.java:289) @ org.h2.mvstore.db.valuedatatype.writevalue(valuedatatype.java:381) @ org.h2.mvstore.db.valuedatatype.write(valuedatatype.java:189) @ org.h2.mvstore.db.transactionstore$versionedvaluetype.write(transactionstore.java:1695) @ org.h2.mvstore.page.write(page.java:737) @ org.h2.mvstore.page.writeunsavedrecursive(page.java:818) @ org.h2.mvstore.page.writeunsavedrecursive(page.java:824) @ org.h2.mvstore.mvstore.storenowtry(mvstore.java:1060) @ org.h2.mvstore.mvstore.storenow(mvstore.java:976) @ org.h2.mvstore.mvstore.commitandsave(mvstore.java:965) @ org.h2.mvstore.mvstore.writeinbackground(mvstore.java:2373) @ org.h2.mvstore.mvstore$backgroundwriterthread.run(mvstore.java:2586) 03-28 15:46:44.916 413-680/? w/activitymanager﹕ force finishing activity com.example.me/.view.settingsactivity 03-28 15:46:45.856 9512-9512/? i/choreographer﹕ skipped 49 frames! application may doing work on main thread. 03-28 15:46:46.316 9512-9512/? w/egl_emulation﹕ eglsurfaceattrib not implemented 03-28 15:46:48.576 9512-9512/? e/windowmanager﹕ android.view.windowleaked: activity com.example.me.view.settingsactivity has leaked window com.android.internal.policy.impl.phonewindow$decorview{b51f0f90 v.e..... r....... 0,0-320,140} added here @ android.view.viewrootimpl.<init>(viewrootimpl.java:348) @ android.view.windowmanagerglobal.addview(windowmanagerglobal.java:248) @ android.view.windowmanagerimpl.addview(windowmanagerimpl.java:69) @ android.app.dialog.show(dialog.java:286) @ com.example.me.util.updater.onpreexecute(updater.java:60) @ android.os.asynctask.executeonexecutor(asynctask.java:587) @ android.os.asynctask.execute(asynctask.java:535) @ com.example.me.util.downloader.onpostexecute(downloader.java:161) @ com.example.me.util.downloader.onpostexecute(downloader.java:18) @ android.os.asynctask.finish(asynctask.java:632) @ android.os.asynctask.access$600(asynctask.java:177) @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:645) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:136) @ android.app.activitythread.main(activitythread.java:5017) @ java.lang.reflect.method.invokenative(native method) @ java.lang.reflect.method.invoke(method.java:515) @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:779) @ com.android.internal.os.zygoteinit.main(zygoteinit.java:595) @ dalvik.system.nativestart.main(native method)
this not h2 problem errors come other part of app because heap size small , try read big chunk of file , insert database, change program logic on reading file , works perfectly.
Comments
Post a Comment