[Sugar-devel] OOM (was Re: Appearance Customization)

Bert Freudenberg bert at freudenbergs.de
Mon Nov 8 06:13:11 EST 2010


On 07.11.2010, at 22:08, Tabitha Roder wrote:

>  Re memory usage - we already go through the "please don't open too many activities" routine all the time 
> 
> How come my Android phone is okay with running everything at once?

It doesn't. It just makes it look like it is.

> What does it do that means I don't run out of memory? Can we do that to Sugar? Apparently the phone is killing apps when it needs to but when you restart the application it picks up where it left off (I might be repeating something already discussed on this list?). 

Of course you are ;)

Sugar was intended to kill background activities if resources got low, too. But there never were enough engineering resources to make it work. There have been experiments with the OOM killer, but I think the only result was to acknowledge that It Is A Hard Problem.

Sugar is much closer to "regular" Linux than Android. This is intentional, we wanted to make "sugarizing" normal Linux applications easy, and even allow to run them directly (both to invite open-source developers and leverage existing code as possible). We were successful at that, there is indeed very little difference between an activity and any other X11 app (and we intend to make the difference even smaller).

So the upside is that a Sugar activity is almost like a regular Linux app. The downside is that a Sugar activity is almost like a regular Linux app. 

Activities are supposed to save their complete state to the Journal. That would include which view is displayed, where the cursor is, etc. If they did that, then stopping and resuming an activity would be seamless. The user wouldn't even notice it happened.

But few Sugar activities do that. There are no general facilities to help the developer make it work. Also, there is little incentive to do it, since there is no automatic killing of activity. And one reason there is no killing is that starting an activity is just too slow. And when sugarizing an existing app it would be really hard because desktop applications are rarely designed for this.

Android had the luxury of starting with a pretty clean slate. Everything above the Linux kernel (and even inside it) was designed to make this work. There isn't even the concept of the whole app staying in RAM, it is only a small part that stays resident when switching away. Saving the state of that part is comparatively simple.

I don't see how Sugar could do something similar without a complete redesign.

> Back in the old days, Sugar showed you how many activities were running in the home view, that might have been more obvious to kids that they were overloading their laptops. 
> Would it be possible to have a message pop up that says "you are running out of memory, which activity would you like to close" or similar so they are alerted to running too much stuff. 


Well, asking the user is always the cheap way out, but we might not have the resources to do better.

- Bert -

PS: Overall it's amazing how much Sugar "got right" on its own though. Fullscreen apps, automatic saving/resume, sandbox security, app bundles, these are all features Sugar shares with Android and iOS. But when Sugar development started in 2006 (*) these were not around yet. There was no obvious software to use as a base with these features. The Android "preview" SDK was released in Nov. 2007 but there was no hardware yet, the iPhone SDK was released in March 2008. Still, when OLPC started mass-producing the XO-1 in 2007 there were third-party Sugar activities already.

(*) http://dev.laptop.org/git/sugar/commit/?id=2cc103db83ed1550e2a9e92bf3306e4476c1297a
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20101108/56f548a1/attachment.html>


More information about the Sugar-devel mailing list