Loading...

android-platform@googlegroups.com

[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: Dalvik heap fragmentation and recovery Mattaku Betsujin Mon Mar 09 15:00:24 2009

Thanks for you suggestions. I'll give them a try.

On Mon, Mar 9, 2009 at 12:34 PM, Dan Bornstein <[EMAIL PROTECTED]> wrote:

>
> On Mon, Mar 9, 2009 at 1:19 PM, Mattaku Betsujin
> <[EMAIL PROTECTED]> wrote:
> > But, about killing and restarting the app, do you think my Solution 2 is
> OK?
>
> (quoting Solution 2 from the original post)
>
> > Include a "restart helper" activity in the app. When the main activity's
> > heap is over 12MB, start the Restart Helper with
> > FLAG_ACTIVITY_NEW_TASK. Restart Helper would display a
> > "cleaning up ..." screen, kill the main activity's process, and relaunch
> it
> > with FLAG_ACTIVITY_NEW_TASK. Finally, kill the Restart Helper
> > process.
>
> I am far from an expert at what goes on at the higher layers of the
> system, so I am wary of making any recommendations, but this doesn't
> strike me as a particularly nice way to clean up. I would really go
> with SoftReferences as a first recourse.
>
> As a second recourse, you might look into using explicitly-managed
> files in your app's cache directory.
>
> Based on what I know about your app (admittedly little), I think you
> can make it work without actually having to force it to restart.
>
> -dan
>