Bump - Native App Background Notifications

Having both UI and headless (background) versions of the app running at the same time may easily double the usage of memory and other resources (and in case if sadboxing is applied - more than double). When even a single large program periodically runs out of memory, that really looks like an unnecessary overhead. Why not just to keep the app minimized.

2 Likes

Well thats what I do at the moment - keep all these apps open as best I can - Sailslack, Piepmatz, Fernschreiber, Whisperfish, etc. Trouble is they don’t stay open - even on my new shiny X10 III with 6Gb memory. As soon as I open, say the browser, or the Documents then apps start closing themselves.

If there is no easy or current solution to implementing background notifications on SFOS efficiently so that they use less resources than keeping multiple apps open all the time and constantly re-opening them when they get killed then fine - I only asked. I just don’t understand the hostility of some of these experts who can’t bear any criticism whatsoever of their beloved and worshipped Sailfish.

As an example, I profiled Fernschreiber and found that most of the heap is being consumed by tdlib rather than UI. Meaning that even if the background service isn’t using any UI at all, it would be roughly as much a memory hog as the full-blown app. The app + background service combination would eat up roughly twice as much. Instead of a periodically dying app you would get a periodically dying app plus a periodically dying background service. It could be even that the system won’t be able to run both at the same time - starting the app would kill the service, and restarting the service would kill the app.

IMO it’s not worth the efforts, at least not in the case of Fernschreiber. But as a learning experience, why not. As long as the originally usable app doesn’t get destroyed in the process :slightly_smiling_face:

In some simpler cases it may be quite doable though, and perhaps even make certain amount of sense.

Also, one has to keep in mind that closing the UI doesn’t save much memory - the only way to avoid UI overhead is to never instantiate any UI objects at all.

I have something like that running on my volla phone with 4GB ram and can do video encoding without the oom killer calling.

I think you need to profile what’s going on. My experience on the Xperia 10ii is also better than what you are depicting. maybe a full list from ps faux?

@slava Thank you for such a clear and positive explanation of the issues. If for some apps there is no clear advantage to separating the foreground UI bit and the background ‘daemon’ maybe, as an alternative, there could be an option to keep certain apps active - so they start at boot up and have a higher priority than others to ensure they don’t get randomly killed when resources are low - that way at least we wouldn’t miss any messages with apps like Fernschreiber.

Watching videos in the browser, or in Piepmatz, or whatever, is a sure fire way to get the app closed down here - although, to be fair, they do start up again after going back to the minimised cover and having the rotating circle for a bit. When I have more time I’ll have a look into which processes are hogging the ram. I don’t think its a process that has gone rogue (well, if it is then its always going rogue) because a re-boot doesn’t make things any better after I’ve started up all my apps. Maybe I’m just trying to keep too many apps running all the time, period.

I think somebody did say that because the X10 III is 64 bit architecture then apps naturally use more ram - but I may be wrong on this.

First computer I ever programmed for was an Elliott 803B mainframe with 8K of ram (well, ferrite core memory actually) - yes - that’s not 8Gb, or 8Mb, but 8K. OK the word length was 39 bits (+ 1 for parity checking) so I suppose that’s nearer 40 Kbytes, but even so - these days you couldn’t even store one hi res picture on it. Then, it ran programs that did all the type setting and controlled printing presses for newspapers, ran research projects for universities and broke codes during the Cold War. How times have changed - my phone has 6Gb, and that is seemingly not enough!

yeah, I know what you mean. I learned assembly on a Vax mainframe emulating 8080a and z80 processors. Pretty new by Elliott standards, but then, I’m a spring chicken :slight_smile:

Something is definitely off. Unless you’re running 20 apps :slight_smile:

Just remembered that I learned an early progenitor of SGML on some IBM machine with a Photon II believe) photomechanical typesetter. Type up SGML you view on a little green screen, out comes photopaper to be glued (with wax) to layout boards. Printing pushed my development as a programmer more than any other thing well past the DTP heyday.