desktop entry proposal: TerminateSafe=true key

Colin Walters walters at
Sat May 8 07:59:16 PDT 2010

On Fri, May 7, 2010 at 10:13 PM, Federico Mena Quintero
<federico at> wrote:
> You are using your fat desktop.  You (possibly inadvertently) download a
> huge-ass image which gets displayed in Firefox or EOG.  Most of
> everything gets swapped out to make room for the uncompressed image.
> But when you close the Firefox tab or EOG window, things gradually get
> swapped back in and your machine goes back to normal.  It would be bad
> to break this behavior by killing stuff.

Depends how large it is and how much memory and swap you have; it's
certainly possible that the OOM killer would be invoked, and who knows
what happens then.  It could kill Xorg.

We could argue what should happen in this situation for a long time -
probably to some degree Firefox has to avoid loading images like that.

I kind of disagree that killing apps "breaks" that behavior.  Honestly
if you're hitting nontrivial amounts of swap on a desktop machine,
performance turns dire. Isn't it better to get quickly back to a
system you can interact with, and be able to restart apps (possibly
fewer than before)?

> I don't have a good solution, but just "TerminateSafe=true" seems rather
> simplistic.  As Lennart said, the kernel can't even notify userspace
> about memory pressure yet.

The thing is, it's simply information.  Nothing requires userspace to
actually use it immediately.  Though actually, it would clearly make
sense to take advantage of this for shutdown/reboot; we know we don't
need to context switch to the app to ask it politely to quit, we can
just kill it.

> What's memory pressure, anyway?

My take would be that you're hitting large amounts of swap from
desktop applications.  Or more generally, if pressure is so great that
Xorg and/or the compositor start getting swapped out.

More information about the xdg mailing list