Monday, October 8, 2012

[android-developers] Re: Grow heap (frag case) for allocation

tj wrote:
hello frnzz,
In my project i am fetching a text file from row folder. file size is near about 3 MB. each and every time while reading that text file, heap size grows rapidly. after reaching it's memory limit it gives outOfMemoryException. i have used bufferReader, inputStream and stringBuilder to read file. geeks plz help me. hope for positive responce.

"Plz" show us how you're reading the file.

There are various ways to control memory and avoid packratting,  
the failure to let go of obsolete references. You might not be using 
garbage-collection-friendly idioms. Asking for more memory when you 
aren't managing the memory you already have is tantamount to asking 
for the OOME to continue.

3 MB isn't all that large a file even for Android. I suspect your code is what
has the problem. Perhaps you could put together a Simple, Short, Complete, 
Compilable Example, or SSCCE 
http://sscce.org/
that demonstrates the issue?

Without seeing what you've done, it's a shot in the dark to recommend what 
to do instead.

-- 
Lew

--
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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate