Out of memory on dalvikvm

Put your problem here if it does not fit any of the other categories.

Out of memory on dalvikvm

Postby tsdt » Sat Jan 19, 2008 7:56 pm

I am coding Dictionary, the function Readfile return the String[110000] to keyword,so the keyword is the array of String such as {"a","an","b","be","been",...} (words in Dictionary,about 108000 words)
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  2. String[] keyword = new String[110000] ;
  4. keyword = Readfile("eng-viet109K.txt");
Parsed in 0.010 seconds, using GeSHi

i met a problem in the dalvik VM like this:

E/dalvikvm-heap(585): Out of memory on a 62-byte allocation.
E/dalvikvm(585): VM aborting

I do not know how to expand or change the dalvik VM configuration.
May be the quatity of words is too much?(My database txt file include 2 file: eng-viet.txt (1.9Mb) and eng-viet.res(4.4Mb))
Please help me!

Junior Developer
Junior Developer
Posts: 12
Joined: Wed Jan 09, 2008 4:20 am
Location: VIETNAM


Postby plusminus » Sat Jan 19, 2008 8:16 pm

Hello tsdt,

hm, you have
Lets say you have an average of 7 chars per entry, what means 14 bytes of info (because of unicode) + 4 bytes of string-lenght-information.
This results in 18 Bytes * 110000 Entries ~ 2MB of data :!:
So you should think about loading only the relevant parts of your dictionary. Perhaps splitting to smaller parts already helps.

For comparison, the total Heap-Size of my PizzaTimer is just 1,5MB. (watch it in the DDMS-View (click "update HEAP" on the specific process))

Btw, there is an issue about Androids Garbage-Collector which is said not to work properly. (so perhaps it is not your fault)

Image | Android Development Community / Tutorials
User avatar
Site Admin
Site Admin
Posts: 2688
Joined: Wed Nov 14, 2007 8:37 pm
Location: Schriesheim, Germany


Return to Other Coding-Problems

Who is online

Users browsing this forum: Google [Bot] and 4 guests