Yup, that's because the data is effectively doubled as it needs to be passed from the native side to the Javascript side. When you are downloading the data from the net it is just coming down to the JavaScript side of things.
Hmmm...I should open an improvement for file reading to do it in chunks. Simon Mac Donald http://hi.im/simonmacdonald On Thu, Sep 6, 2012 at 11:00 AM, Clemens Wyss <clemens...@mysign.ch> wrote: > Simon, thx for your reply. > But why then can I download the "same amount" to my device and then save > it? Anda t the very same time the content (being json) is decoded into RAM > ... > Only when trying to load from FS I get the OOM ... > > -----Ursprüngliche Nachricht----- > Von: Simon MacDonald [mailto:simon.macdon...@gmail.com] > Gesendet: Donnerstag, 6. September 2012 16:56 > An: callback-dev@incubator.apache.org > Betreff: Re: apache-cordova - FileReader#readAsTextFile throws OOM when > reading local file > > It's just too much memory for the HTC Desire to handle. Each application > has a piece of the system memory on the HTC Desire the RAM is 384 MB while > on the Samsung Galaxy S2 has 1 GB or RAM. I'm making the assumption that > the available memory for each application is much smaller on the HTC device > as it has one third the memory of the Samsung and that's probably why you > are getting the OOM exception. > > Simon Mac Donald > http://hi.im/simonmacdonald > > > On Thu, Sep 6, 2012 at 8:21 AM, Clemens Wyss - MySign AG < > clemens.w...@mysign.ch> wrote: > > > Hi all (me being new to this mailinglist), > > > > Context: > > cordova 2.0-app on my HTC Desire (Android 2.3.7) jQuery 1.7.1 > > jQuery.mobile 1.1.1 > > > > I try to read a json file (2.5MB) from my HTC Desire. > > fileReader.readAsTextFile(...) throws an out of memory exception. > > Is 2.5M "too much"? > > > > Thx > > Clemens > > > > Note 1: > > I am able to download the very file (through $.ajax) and save it > > locally using FileWriter. Could it be that in "this case" the file is > > being streamed and not completely read into RAM? > > > > Note 2: > > Having no problem on a Samsung Galaxy2 with Andorid 4.03 > > >