Wednesday, March 9, 2011

[android-developers] Re: Managing Out of memory

Thanks Thomas. Is there any benifit of using
Runtime.getRuntime().freeMemory() over ActivityManager.MemoryInfo()?
MemroyInfo.availMemory also gives free memory size but for the device.

On Mar 9, 12:42 pm, Thomas <thomasjakw...@gmail.com> wrote:
> you could model this in an algorithmic fashion:
>
> check memory
> if memory is sufficient
>      fetch images
> if low memory (after image fetch),
>      release previously fetched image(s)
>
> check out the java.lang.Runtime class, it has exactly the functions
> you're looking for (specifically totalMemory() for the device's total
> memory, and freeMemory() for how much free memory is left)
>
> Here it is on the android developer website:http://developer.android.com/reference/java/lang/Runtime.html
>
> On Mar 9, 1:06 am, Manish Garg <mannishga...@gmail.com> wrote:
>
>
>
> > Hi All,
>
> > I want to check low memory state in my application. In my application
> > i am fetching some iamges from the server and displaying them in the
> > gallery. I am fetching images in batch, not at single time. At the
> > time of low memory, i want to release previously fetched image so that
> > i can store newly fetched images.
>
> > my approach is to find out available memory, compare it with the
> > threshold memory. If both are equal then release previously fetched
> > images. but size of the threshold is in MB, while i would require only
> > 500kb to 1 MB for new images.
>
> > Please give me some idea.- Hide quoted text -
>
> - Show quoted text -

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

No comments:

Post a Comment