• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to manage

velm40

Lurker
http://stackoverflow.com/questions/...5943816-byte-allocation-when-accessing-xml-s#
In my application, i am using ksoap2 for retrieving data from .net web service. Data which we are transferring is in format called "xml string". It works fine if i accesses 1000 item records. But When i am trying to access 12000 item records from server it is giving "Out of memory on an 5943816 byte allocation" error in my logcat.
////////////////// My code for retrieving data from server,
SoapObject request = new SoapObject(NAMESPACE, METHOD_NAME); SoapSerializationEnvelope envelope = new SoapSerializationEnvelope( SoapEnvelope.VER11); request.addProperty("myparameter", myparameter); envelope.dotNet = true;// to handle .net services asmx/aspx envelope.setOutputSoapObject(request); HttpTransportSE ht = new HttpTransportSE(MyURL); ht.debug = true; ht.call(SOAP_ACTION, envelope); // to change dialog publishProgress("Moving data file"); SoapObject resultString = (SoapObject) envelope.getResponse(); //////////////////
I know that this is because of heap size problem. But i dont know how to solve this, If any one have solution for this please help me..
 
This is definitely not a 'fix' but something that might help you on newer devices with more memory like tablets.

<application> largeHeap='true'

Ultimately i think you will need to change how you retrieve the data. You might need to 'page' your data in smaller chunks. You could also read a stream in and write the data to a local sqlLite database. Then perform your work against the database in smaller chunks / more efficient.

Another thought to tag onto the previous suggestion, i think you should remove references to the objects as you can. Null them out and allow GC to clean them up.
 
Back
Top Bottom