Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
OOM Data Manager and Mem Monitor Migration Path
Hi. I saw interesting material on OOM handling and warnings at the following qt link: http://doc.qt.nokia.com/qtextended4.4/syscust-oom.html
I'm just wondering if this is going to find its way into qt 4.7 going forward? Or, if not what are the equivalent capabilities? If there are none, is there rationale for dropping this functionality.
Thanks very much. Vince
GordonSchumacher last edited by
This mechanism is really not necessary under a 2.6 kernel; the oom_adj feature described accomplishes much the same task. The 2.6.x series has pretty much caught up with 2.4.x with regards to being able to run on "minimal" devices. I had a heavily customized Gentoo-based system running from a 16MB CompactFlash card on a "Soekris 4521":http://www.soekris.com/net4521.htm, which you have to admit is a whole lot more minimal than much of anything you're going to see these days.
It was running kernel 2.6.31, udev, hotplug - in short, other than being based on uclibc, a modern if minimal Linux system.
Thanks for the reply. I agree the oom_adj feature is nice. I'm really wondering about the low memory monitor and the low memory handler? I think emitting a signal (or a warning if you will) to apps from the low memory handler has some great advantages. For instance, if apps choose to connect to this warning signal and take action, then purging apps from memory can be avoided more often, and subsequent start-up times can remain low...the overall user experience would be "snappier" a higher percentage of the time. What is the QT team's thoughts concerning the low memory handler? Thanks again.
(disclaimer: I'm not a Troll, but I do contribute to Qt when I can)
I've very mixed feelings about something like this.
While I can see the benefit it might provide, I really think that managing memory (and making the best uses of it) should be left to the operating system itself, rather than to the applications, especially when you have swap on most modern operating systems.
There's two reasons here.
First, getting memory management right is hard, and as such, you can't expect every developer to be as smart as yourself, and know what to drop, and when. So, this becomes something very much hit or miss, which kind of defeats the point of it.
Secondly (and more technically), if your application has resources it infrequently uses (assuming you are on an OS with swap), those pages should be swapped out of memory to leave physical memory enough room to contain things that are used.
Now, imagine you send your 'low memory' signal just after you've swapped out a bunch of things. Your application is going to want to delete them, but that is going to involve swapping them back in first, just to delete them. To do that, the OS will have to swap something else, which was probably actually being used, out.
When this situation gets really bad, you can end up with the entire system going unresponsive for a long period of time. The longest I've seen (and waited for) was 30 minutes for a desktop to recover from 'swap thrashing'.
I think a better idea is to be smart about what you're storing in RAM, and even if you think you know everything there is to know, use a memory profiler (like massif) to double check your knowledge - you can often find quite a bit there to get rid of in larger applications.
Thanks for the reply. I should have mentioned that I'm assuming swap space is 0. Any other thoughts appreciated.
Then I'll add that I'd still not recommend it, because most systems (including mobile) are moving towards 'convergence' with desktop-type systems, which includes having swap, etc.
If you look at the mobile OS environment, you have Android and Maemo/MeeGo, both of which are powered by Linux under the hood (and possibly iOS, though I'm not sure off the top of my head there) - which all have the ability to use swap.
As well as that, Qt is bigger than just one OS/device/system, so if one OS/device/system requires this, it doesn't necessarily mean that the functionality belongs up in Qt itself - it could fit in a different library of sorts (similar to the gaps that some parts of Qt Extended filled in the past) perhaps.
GordonSchumacher last edited by
Do any Android and M(aem|eeG)o devices actually have swap?
That said, I agree with Robin - I've actually managed to have this happen on my laptop! Very, very occasionally, Firefox gets into a state where it begins leaking memory fairly quickly. If it happens to do that while, say, I'm doing a large cpio transfer, or am uncompressing an .xz file... well, I can type-ahead "kill -9 $(ps -C firefox -o pid=)" and hit return, and then I can go have lunch, while the operating system does its best to grind my hard disk into dust. :)
[quote author="GordonSchumacher" date="1292033566"]Do any Android and M(aem|eeG)o devices actually have swap?[/quote]
I don't own any android devices, so I can't comment about those, but Maemo5 (and I would guess all earlier Maemo releases) have swap, and both MeeGo handset and netbook profiles have it enabled, yeah.