android - Out of memory exception on SQLite database operation -
i have custom listview each list item has 5 entries , these entries come sqlite database. there such 8 list-items in listview. code custom adapter is:
public class vaccinlistadapter extends baseadapter { private context context; private list<vaccininfopojo> vaccininfo; public vaccinlistadapter(context c,list<vaccininfopojo> list) { context=c; vaccininfo=list; } @override public int getcount() { return vaccininfo.size(); } @override public object getitem(int pos) { return vaccininfo.get(pos); } @override public long getitemid(int i) { return i; } @override public view getview(int position, view convertview, viewgroup viewgroup) { viewholder holder; vaccininfopojo entry=vaccininfo.get(position); if (convertview == null) { layoutinflater inflater = (layoutinflater) context .getsystemservice(context.layout_inflater_service); convertview = inflater.inflate(r.layout.vaccin_list_style, null); holder=new viewholder(); holder.diseasevalue=(textview)convertview.findviewbyid(r.id.vaccin_lv_disease); holder.animals=(textview)convertview.findviewbyid(r.id.vaccin_lv_animalnames); holder.vaccinname= (textview)convertview.findviewbyid(r.id.vaccin_lv_vaccinname); holder.dosevalue=(textview)convertview.findviewbyid(r.id.vaccin_lv_dosagevalue); holder.timevalue= (textview)convertview.findviewbyid(r.id.vaccin_lv_timevalue); convertview.settag(holder); } else { holder = (viewholder) convertview.gettag(); } holder.diseasevalue.settext(entry.getdisease()); holder.animals.settext(entry.getanimal()); holder.vaccinname.settext(entry.getvaccine()); holder.dosevalue.settext(entry.getdose()); holder.timevalue.settext(entry.gettime()); return convertview; } }
and using viewholder class suggested here:
static class viewholder { textview diseasevalue,animals,vaccinname,dosevalue,timevalue; }
i getting out of memory exception after long stream of grow heap sequence::
04-18 09:42:46.033: debug/dalvikvm(370): gc_concurrent freed 45k, 21% free 10597k/13255k, external 1055k/1567k, paused 10ms+10ms 04-18 09:42:48.154: info/dalvikvm-heap(370): clamp target gc heap 17.901mb 16.000mb 04-18 09:42:48.154: debug/dalvikvm(370): gc_concurrent freed 68k, 18% free 12622k/15303k, external 1055k/1567k, paused 10ms+11ms 04-18 09:42:48.673: info/dalvikvm-heap(370): clamp target gc heap 18.030mb 16.000mb 04-18 09:42:48.673: debug/dalvikvm(370): gc_concurrent freed <1k, 18% free 12754k/15367k, external 1055k/1567k, paused 11ms+12ms 04-18 09:42:48.893: info/dalvikvm-heap(370): clamp target gc heap 18.030mb 16.000mb 04-18 09:42:48.893: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12754k/15367k, external 1055k/1567k, paused 219ms 04-18 09:42:48.893: info/dalvikvm-heap(370): clamp target gc heap 16.030mb 16.000mb 04-18 09:42:48.893: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 24-byte allocation 04-18 09:42:49.194: info/dalvikvm-heap(370): clamp target gc heap 18.030mb 16.000mb 04-18 09:42:49.194: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12754k/15367k, external 1055k/1567k, paused 219ms 04-18 09:42:49.204: info/dalvikvm-heap(370): forcing collection of softreferences 24-byte allocation 04-18 09:42:49.414: info/dalvikvm-heap(370): clamp target gc heap 18.015mb 16.000mb 04-18 09:42:49.414: debug/dalvikvm(370): gc_for_malloc freed 14k, 18% free 12740k/15367k, external 1055k/1567k, paused 212ms 04-18 09:42:49.414: info/dalvikvm-heap(370): clamp target gc heap 16.015mb 16.000mb 04-18 09:42:49.794: info/dalvikvm-heap(370): clamp target gc heap 18.015mb 16.000mb 04-18 09:42:49.794: debug/dalvikvm(370): gc_concurrent freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 6ms+6ms 04-18 09:42:50.014: info/dalvikvm-heap(370): clamp target gc heap 18.015mb 16.000mb 04-18 09:42:50.014: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 214ms 04-18 09:42:50.014: info/dalvikvm-heap(370): clamp target gc heap 16.016mb 16.000mb 04-18 09:42:50.014: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 60-byte allocation 04-18 09:42:50.314: info/dalvikvm-heap(370): clamp target gc heap 18.016mb 16.000mb 04-18 09:42:50.314: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 223ms 04-18 09:42:50.324: info/dalvikvm-heap(370): clamp target gc heap 16.016mb 16.000mb 04-18 09:42:50.324: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 8-byte allocation 04-18 09:42:50.724: info/dalvikvm-heap(370): clamp target gc heap 18.016mb 16.000mb 04-18 09:42:50.724: debug/dalvikvm(370): gc_concurrent freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 16ms+5ms 04-18 09:42:50.994: info/dalvikvm-heap(370): clamp target gc heap 18.015mb 16.000mb 04-18 09:42:50.994: debug/dalvikvm(370): gc_for_malloc freed <1k, 18% free 12740k/15367k, external 1055k/1567k, paused 247ms 04-18 09:42:51.004: info/dalvikvm-heap(370): clamp target gc heap 16.016mb 16.000mb 04-18 09:42:51.004: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 24-byte allocation 04-18 09:42:51.304: info/dalvikvm-heap(370): clamp target gc heap 18.016mb 16.000mb 04-18 09:42:51.304: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 226ms 04-18 09:42:51.314: info/dalvikvm-heap(370): clamp target gc heap 16.016mb 16.000mb 04-18 09:42:51.314: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 24-byte allocation 04-18 09:42:51.724: info/dalvikvm-heap(370): clamp target gc heap 18.016mb 16.000mb 04-18 09:42:51.724: debug/dalvikvm(370): gc_concurrent freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 20ms+6ms 04-18 09:42:51.934: info/dalvikvm-heap(370): clamp target gc heap 18.016mb 16.000mb 04-18 09:42:51.934: debug/dalvikvm(370): gc_for_malloc freed 0k, 18% free 12740k/15367k, external 1055k/1567k, paused 207ms 04-18 09:42:51.934: info/dalvikvm-heap(370): clamp target gc heap 16.016mb 16.000mb 04-18 09:42:51.934: info/dalvikvm-heap(370): grow heap (frag case) 16.000mb 8-byte allocation
where go now? appreciable.
edit::
i had made huge silly mistake. when running loop fill arraylist data loop like:
for(cursor.movetofirst();!cursor.isafterlast();cursor.movetofirst())
here last movetofirst getting loop infinite state. changed movetonext. whoa...god bless me.!!!
Comments
Post a Comment