Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions |
The OomManager class manages low and out of memory situations. More...
#include <OomManager>
Inherits QObject.
The OomManager class manages low and out of memory situations.
This class is a wrapper for the Out-of-memory manager. It is used in sublasses of the ApplicationTypeLauncher class that launch applications as linux processes. It is also used in ApplicationLauncher and LowMemoryTask.
This class contains three sets of application names. The first set is called critical. It contains the names of all the Qt Extended applications that must not be killed, when Qt Extended runs out of memory, eg Qt Extended itself (qpe) is in the critical set.
The second set is called expendable. It contains the names of the applications that the user wants killed first, when Qt Extended runs out of memory.
The third set is called important. It contains the names of applications the user wants to avoid killing, if possible, when Qt Extended runs out of memory. Important processes will not be killed if there are expendable processes running, but expendable processes can be killed. Only critical processes are not killable.
All this data is read from a configuration file called oom.conf. The user can create oom.conf with a text editor. Here is an example:
[oom_adj] qpe=critical qasteroids=expendable fifteen=expendable minesweep=expendable snake=expendable calculator=important clock=important datebook=important [values] critical=250 verylow=120 low=60 samples=5 percent=20 long=10000 short=1000 rlimit=32
Whenever a new process achieves the running state, its name and pid are inserted into a map here. Additionally, the process's oom_adj value is set here according to whether the process is critical, expendable, or important. The oom_adj value is used by the linux kernel to help it determine which processes to kill when a hard out-of-memory condition occurs. The oom_adj value is stored in /proc/<pid>/oom_adj.
Note: All OomManager instances share the same internal list of applications.
This class is part of the Qt Extended server and cannot be used by other Qt Extended applications.
This enum is used to describe the various application priority as seen by the OOM Manager.
Constant | Value | Description |
---|---|---|
OomManager::Expendable | 0 | Expendable applications have lowest priority and will be killed first. |
OomManager::Important | 1 | Important applications should only be killed if no expendable applications are left to be killed. |
OomManager::Critical | 2 | Critical applications cannot be killed. |
This constrcutor creates a new OomManager instance.
Destroys the OomManager instance.
Returns a reference to the map of expendable processes. that maps application name to process id. The map can be empty.
Returns true if at least one of the running process is marked as being expendable.
Returns true if at least one of the running process is marked as being important.
Returns a reference to the map of important processes. that maps application name to process id. The map can be empty.
Insert a mapping from app to pid. The process pid must be in the running state, and it must be an instance of app. This function must be called when process pid enters the running state.
The value in /proc/pid/oom_adj is set to a value read from oom.conf according to whether the process is a critical, expendable, or important process.
Returns true if app is not marked important or critical.
Returns true if app is marked important.
Returns the application name of the process marked as t that has the biggest OOM score.
Remove the mapping from application app to its process id. This function must be called for any linux process started by the ApplicationLauncher, when the process is terminated for any reason.
Copyright © 2009 Nokia | Trademarks | Qt Extended 4.4.3 |