Emulator "memory" problem

boten

Active Member
Licensed User
Longtime User
Trying to read a "large" number of text lines into a list using File.ReadList
My file has about 2200 lines each about 480 chars long.

Testing on the emulator produces java.io.IOException on the File.ReadList stmt.

(the unfiltered log shows a lot of C_FOR_MALLOC .....

GC_FOR_MALLOC freed 8438 objects / 575304 bytes in 60ms
GC_FOR_MALLOC freed 15565 objects / 528880 bytes in 70ms
GC_FOR_MALLOC freed 22013 objects / 539760 bytes in 60ms

)


This is "obviously" (??) a memory problem on the emulator, as it runs perfectly with a small number of lines, and runs equally well on the phone with all 2200+ lines.

My question is what parameter (if any) controls the amount of "memory" on the emulator. I tried specifying 64MB as SD card in the AVD Manager but to no avail. Anyone knows how to increase the memory of the emulator?
 

boten

Active Member
Licensed User
Longtime User
Filtered log follows (will post entire unfiltered if needed)

B4X:
LogCat connected to: emulator-5554
** Activity (main) Create, isFirst = true **


main_init_data (java line: 1372)



java.io.IOException
   at android.content.res.AssetManager.readAsset(Native Method)
   at android.content.res.AssetManager.access$700(AssetManager.java:36)
   at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:574)
   at java.io.InputStreamReader.read(InputStreamReader.java:275)
   at java.io.BufferedReader.fillBuf(BufferedReader.java:155)
   at java.io.BufferedReader.readLine(BufferedReader.java:386)
   at anywheresoftware.b4a.objects.streams.File$TextReaderWrapper.ReadLine(File.java:536)
   at anywheresoftware.b4a.objects.streams.File$TextReaderWrapper.ReadList(File.java:577)
   at anywheresoftware.b4a.objects.streams.File.ReadList(File.java:220)
   at killsud.boten.main._init_data(main.java:1372)
   at killsud.boten.main._activity_create(main.java:347)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:105)
   at killsud.boten.main.afterFirstLayout(main.java:84)
   at killsud.boten.main.access$100(main.java:16)
   at killsud.boten.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
   at dalvik.system.NativeStart.main(Native Method)
java.io.IOException
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Thx. I just love those "make shift" solutions :icon_clap: But how come it works with big text file (.txt) when compiling to phone and NOT working when compiling to emulator?
 
Last edited:
Upvote 0
Top