Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

OomManager Class Reference
[QtBaseModule, QtDevToolsModule]

The OomManager class manages low and out of memory situations. More...

    #include <OomManager>

Inherits QObject.

Public Types

  • enum Importance { Expendable, Important, Critical }

Public Functions

  • 29 public functions inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 1 signal inherited from QObject
  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

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.


Member Type Documentation

enum OomManager::Importance

This enum is used to describe the various application priority as seen by the OOM Manager.

ConstantValueDescription
OomManager::Expendable0Expendable applications have lowest priority and will be killed first.
OomManager::Important1Important applications should only be killed if no expendable applications are left to be killed.
OomManager::Critical2Critical applications cannot be killed.


Member Function Documentation

OomManager::OomManager ()

This constrcutor creates a new OomManager instance.

OomManager::~OomManager ()

Destroys the OomManager instance.

const QMap<QString, int> & OomManager::expendableProcs () const

Returns a reference to the map of expendable processes. that maps application name to process id. The map can be empty.

bool OomManager::hasExpendableProcs () const

Returns true if at least one of the running process is marked as being expendable.

bool OomManager::hasImportantProcs () const

Returns true if at least one of the running process is marked as being important.

const QMap<QString, int> & OomManager::importantProcs () const

Returns a reference to the map of important processes. that maps application name to process id. The map can be empty.

void OomManager::insert ( const QString & app, int pid )

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.

bool OomManager::isExpendable ( const QString & app ) const

Returns true if app is not marked important or critical.

bool OomManager::isImportant ( const QString & app ) const

Returns true if app is marked important.

QString OomManager::procWithBiggestScore ( Importance t ) const

Returns the application name of the process marked as t that has the biggest OOM score.

void OomManager::remove ( const QString & app )

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.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 41
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 6
Page suivante

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt qtextended4.4
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web