I've also proposed a solution to this - adding a permission for apps
to request that they run alone, uninterrupted by other processes.

That is, the app can request a permission, demanding that the app can
only be interrupted by an external event, such as phone call, all
other services and background processes (other than the ones the OS
can't go without) are paused when app is running.

I know it's quite tricky to implement this, because, for example, when
an SMS is received it needs to be stored in the database, and this
will require some memory, which will need to be discarded, when the
SMS is written to the database, and this will trigger GC. However,
when such a message is received, and the OS knows that an app with the
special permission runs in the foreground, it could delay the GC
either until:

- the app itself allocates memory (no matter if it might not be
actually GC'ed until the app finishes) OR
- the systems goes pretty low on memory

At least, non-stock services (i.e. services, developed by 3rd parties)
can be suspended during the lifetime of an application requesting the
special permission.

Cheers


On Thu, Mar 26, 2009 at 11:51 AM, Stoyan Damov <stoyan.da...@gmail.com> wrote:
> On Wed, Mar 25, 2009 at 11:02 PM, Romain Guy <romain...@google.com> wrote:
>>
>> The trick is simple: avoid any allocation that might trigger a GC.
>>
>
> It's not that simple at all.
> In fact, it is *impossible* on Android, or any other mobile OS which
> allows background processes.
>
> I've already said this once -- even though your game can be tuned to
> the max, nothing prevents *other* apps from triggering GC.
> That is, in my game, I *never*, *ever* do any allocation after startup.
> However, other background processes do trigger GC, and voila - my game
> stutters for a bit when GC kicks in.
>
> Compare to iPhone, which disallows background processing and the
> foreground app is never interrupted.
>
> Cheers
>

--~--~---------~--~----~------------~-------~--~----~
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-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to