Thursday, March 14, 2013

Re: [android-developers] Re: OutofMemory Excepton error in android

Actually even 5K can crash his app... it all depends on what he did before the allocation.
Android has a nasty bug of claiming you dont have enough memory even if your heap has more than enough free space if it grew close to its maximum value previously (and dont't forget fragmentation as well, 10MB of free heap doesn't mean you can allocate 10MB).

Basically i found that if i get a OOM exception when the allocated size isn't something  enormous, it's usually because is misbehaved earlier :)

So my suggestion to Karunakar (assuming he can't do random reads on the file and the file isn't really big) is to profile his app and see if he needs to do some fixing up before he gets to the point of reading the file.
Other than that, he can always try the big heap flag or just dump everything to native heap.

On Thursday, March 14, 2013 7:38:56 AM UTC+2, Kristopher Micinski wrote:
how big is the file you're reading..?

In general, you can't allocate that much space on Android.  To combat
this you need to be able to do lazy I/O.

But ... are you trying to read in a dictionary (using apertium?).  I'd
guess this is a few megabytes at least right?  Having a megabyte or
two on the heap won't necessarily crash your app, but having more than
that certainly can!  (This of course, depends on the device..)

Kris


On Thu, Mar 14, 2013 at 12:49 AM, karunakar medamoni
<kannaia...@gmail.com> wrote:
> Hi Richard
>
> Good Morning. As per your mail am attaching my android log file. Please have
> look at once. I ran the same program from command line and also in eclipse.
> I got the output , when i try to integrate with android am getting this
> error.
>
>  Thanks & Regards
>
> M. Karunakar
> University of Hyderabad,Hyd,
> 9491388035.
>
>
> On Wed, Mar 13, 2013 at 10:43 PM, karunakar medamoni
> <kannaia...@gmail.com> wrote:
>>
>> Hello Richard
>>
>> Thank u for u reply. I will be back  with full stack from LogCat by
>> tomorrow morning.
>>
>>  Thanks & Regards
>>
>> M. Karunakar
>> University of Hyderabad,Hyd,
>> 9491388035.
>>
>>
>> On Wed, Mar 13, 2013 at 6:11 PM, RichardC <richard...@googlemail.com>
>> wrote:
>>>
>>> Can you include the full stack trace from LogCat please.
>>>
>>>
>>> On Wednesday, March 13, 2013 11:37:16 AM UTC, karunakar medamoni wrote:
>>>>
>>>> Hello
>>>>
>>>> Every one. This is karunakar working on android project. Am converting
>>>> apertium based webpage to android app. When i try to run
>>>> com.apertium.lttoolbox.LTPorc class with two arguments filename.bin file and
>>>> input file am getting this error. If any help from any one it would be
>>>> helpful for me.
>>>>
>>>> Here am pasting my code please have a look at once.
>>>>
>>>> System.setOut(new PrintStream(new BufferedOutputStream(new
>>>> FileOutputStream("/data/data/com.samsaadhani.sandhi1/files/output"))));
>>>>                     FileOutputStream fis = openFileOutput("input",
>>>> Context.MODE_PRIVATE);
>>>>                     fis.write(input.getText().toString().getBytes());
>>>>                     fis.write("\n".getBytes());
>>>>                     fis.close();
>>>>                     LTProc.main(new
>>>> String[]{"/data/data/com.samsaadhani.sandhi1/files/skt_morf.bin","/data/data/com.samsaadhani.sandhi1/files/input"});
>>>
>>> --
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Android Developers" group.
>>> To post to this group, send email to android-d...@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> android-developers+unsubscribe@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/android-developers?hl=en
>>> ---
>>> You received this message because you are subscribed to a topic in the
>>> Google Groups "Android Developers" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/android-developers/feA_XKu8N1o/unsubscribe?hl=en.
>>> To unsubscribe from this group and all its topics, send an email to
>>> android-developers+unsubscribe@googlegroups.com.
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>>
>>>
>>
>>
>
> --
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-d...@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscribe@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Android Developers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to android-developers+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

--
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
---
You received this message because you are subscribed to the Google Groups "Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment