Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Grow heap (frag case) for allocation

Received: by 10.66.75.39 with SMTP id z7mr4334315pav.26.1349719790022;
        Mon, 08 Oct 2012 11:09:50 -0700 (PDT)
X-BeenThere: android-developers@googlegroups.com
Received: by 10.68.194.202 with SMTP id hy10ls23214030pbc.0.gmail; Mon, 08 Oct
 2012 11:06:36 -0700 (PDT)
Received: by 10.68.238.201 with SMTP id vm9mr4637011pbc.6.1349719596835;
        Mon, 08 Oct 2012 11:06:36 -0700 (PDT)
Date: Mon, 8 Oct 2012 11:06:35 -0700 (PDT)
From: Lew <lewbl...@gmail.com>
To: android-developers@googlegroups.com
Message-Id: <b3db8511-59f5-4dbf-a168-6ec9648806db@googlegroups.com>
In-Reply-To: <7b96ed09-2be7-419f-8884-a35c4f626af2@googlegroups.com>
References: <7b96ed09-2be7-419f-8884-a35c4f626af2@googlegroups.com>
Subject: Re: Grow heap (frag case) for allocation
MIME-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_238_19339124.1349719595748"

------=_Part_238_19339124.1349719595748
Content-Type: multipart/alternative; 
	boundary="----=_Part_239_24445411.1349719595748"

------=_Part_239_24445411.1349719595748
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

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


------=_Part_239_24445411.1349719595748
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable

tj wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div>hello frnzz,=
</div>
<div>In my project i am fetching a text file from row folder. file size is =
near about 3 MB. each and every time&nbsp;while reading that text file, hea=
p size grows rapidly. after reaching it's memory limit&nbsp;it gives&nbsp;o=
utOfMemoryException. i have used bufferReader, inputStream and stringBuilde=
r to read file. geeks plz help me. hope for positive responce.</div></block=
quote><div><br></div><div>"Plz" show us how you're reading the file.</div><=
div><br></div><div>There are various ways to control memory and avoid packr=
atting, &nbsp;</div><div>the failure to let go of obsolete references. You =
might not be using&nbsp;</div><div>garbage-collection-friendly idioms. Aski=
ng for more memory when you&nbsp;</div><div>aren't managing the memory you =
already have is tantamount to asking&nbsp;</div><div>for the OOME to contin=
ue.</div><div><br></div><div>3 MB isn't all that large a file even for Andr=
oid. I suspect your code is what</div><div>has the problem. Perhaps you cou=
ld put together a Simple, Short, Complete,&nbsp;</div><div>Compilable Examp=
le, or SSCCE&nbsp;</div><div>http://sscce.org/</div><div>that demonstrates =
the issue?</div><div><br></div><div>Without seeing what you've done, it's a=
 shot in the dark to recommend what&nbsp;</div><div>to do instead.</div><di=
v><br></div><div>--&nbsp;</div><div>Lew</div><div><br></div>
------=_Part_239_24445411.1349719595748--

------=_Part_238_19339124.1349719595748--