Dear ALL,
Do you have any solution to solved out of memory problem when trying to get an XML file which contain two images(base64 text string), size of each XML file is around 500KB.
The problem is when I am trying to request an XML file which contain two images around 15 times, it will show message like text below:
[ERROR][dalvikvm-heap( 1224)] Out of memory on a 1435248-byte allocation. [INFO][dalvikvm( 1224)] "KrollRuntimeThread" prio=5 tid=10 RUNNABLE [INFO][dalvikvm( 1224)] | group="main" sCount=0 dsCount=0 obj=0x406d5708 self=0x1838a8 [INFO][dalvikvm( 1224)] | sysTid=1235 nice=0 sched=0/0 cgrp=default handle=1584336 [INFO][dalvikvm( 1224)] | schedstat=( 118869815374 67341473996 15672 ) utm=11115 stm=771 core=0 [INFO][dalvikvm( 1224)] at java.nio.CharArrayBuffer.<init>(CharArrayBuffer.java:~43) [INFO][dalvikvm( 1224)] at java.nio.ReadWriteCharArrayBuffer.<init>(ReadWriteCharArrayBuffer.java:47) [INFO][dalvikvm( 1224)] at java.nio.CharBuffer.allocate(CharBuffer.java:54) [INFO][dalvikvm( 1224)] at java.nio.charset.CharsetDecoder.allocateMore(CharsetDecoder.java:261) [INFO][dalvikvm( 1224)] at java.nio.charset.CharsetDecoder.decode(CharsetDecoder.java:218) [INFO][dalvikvm( 1224)] at ti.modules.titanium.network.TiHTTPClient.getResponseText(TiHTTPClient.java:566) [INFO][dalvikvm( 1224)] at ti.modules.titanium.network.TiHTTPClient.getResponseXML(TiHTTPClient.java:594) [INFO][dalvikvm( 1224)] at ti.modules.titanium.network.HTTPClientProxy.getResponseXML(HTTPClientProxy.java:84) [INFO][dalvikvm( 1224)] at org.appcelerator.kroll.runtime.v8.V8Function.nativeInvoke(Native Method) [INFO][dalvikvm( 1224)] at org.appcelerator.kroll.runtime.v8.V8Function.callSync(V8Function.java:62) [INFO][dalvikvm( 1224)] at org.appcelerator.kroll.runtime.v8.V8Function.call(V8Function.java:48) [INFO][dalvikvm( 1224)] at org.appcelerator.kroll.runtime.v8.V8Function$1.run(V8Function.java:75) [INFO][dalvikvm( 1224)] at android.os.Handler.handleCallback(Handler.java:587) [INFO][dalvikvm( 1224)] at android.os.Handler.dispatchMessage(Handler.java:92) [INFO][dalvikvm( 1224)] at android.os.Looper.loop(Looper.java:126) [INFO][dalvikvm( 1224)] at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:104) [INFO][dalvikvm( 1224)]
then two images which I get from that XML can't not be displayed on screen.
Any solution please? Thanks in advance.
2 Answers
If this is in the emulator, be sure you have enough storage space. You require 2x+ as much space when downloading. The file is pulled down then copied to its final location. Because the emulator's sdcard image is rather small, it is easy to run out of storage space.
Additionally, I marked Rainer -1 as the file property is iOS only and wont apply to your current use case.
Hi Cheng, the httpclient has a property 'file'. After saving of XML you can open a stream to XML and read it. This save memory. Other way to save memory is to change you procedere. In XML are only meta informations and a link to images.
Hope my toughts helps.
Rainer
Your Answer
Think you can help? Login to answer this question!