KMemoryInfo

Search for usage in LXR

KMemoryInfo Class Reference

#include <kmemoryinfo.h>

Public Member Functions

 KMemoryInfo ()
 
 KMemoryInfo (const KMemoryInfo &other)
 
quint64 availablePhysical () const
 
quint64 buffers () const
 
quint64 cached () const
 
quint64 freePhysical () const
 
quint64 freeSwapFile () const
 
bool isNull () const
 
bool operator!= (const KMemoryInfo &other) const
 
KMemoryInfooperator= (const KMemoryInfo &other)
 
bool operator== (const KMemoryInfo &other) const
 
quint64 totalPhysical () const
 
quint64 totalSwapFile () const
 

Detailed Description

The KMemoryInfo class provides an interface to get memory information (RAM/SWAP).

To use the class, simply create an instance.

KMemoryInfo memInfo;
if (!memInfo.isNull()) {
...
}
Since
5.95

Definition at line 30 of file kmemoryinfo.h.

Constructor & Destructor Documentation

◆ KMemoryInfo() [1/2]

KMemoryInfo::KMemoryInfo ( )

KMemoryInfo Constructs a class with a snapshot of the state of the memory.

If an error occurs, a null object is returned.

See also
isNull.

Definition at line 52 of file kmemoryinfo.cpp.

◆ KMemoryInfo() [2/2]

KMemoryInfo::KMemoryInfo ( const KMemoryInfo other)

KMemoryInfo Constructs a copy of the other memoryinfo.

Definition at line 62 of file kmemoryinfo.cpp.

Member Function Documentation

◆ availablePhysical()

quint64 KMemoryInfo::availablePhysical ( ) const

availablePhysical

The available memory is the free RAM without considering caches and buffers allocated by the operating system.

Note
You should always use this value to check if there is enough RAM for your data.
Returns
The memory available to the processes in bytes.
See also
freePhysical.

Definition at line 109 of file kmemoryinfo.cpp.

◆ buffers()

quint64 KMemoryInfo::buffers ( ) const

buffers

Returns
The size of RAM used as buffers in bytes. This value can be zero.

Definition at line 119 of file kmemoryinfo.cpp.

◆ cached()

quint64 KMemoryInfo::cached ( ) const

cached

Returns
The size of RAM used as cache in bytes.

Definition at line 114 of file kmemoryinfo.cpp.

◆ freePhysical()

quint64 KMemoryInfo::freePhysical ( ) const

freePhysical

The free memory is the amount of free RAM as reported by the operating system. This value is often tainted with caches and buffers used by the operating system, resulting in a low value.

Note
Don't use this value to determine if you have enough RAM for your data.
Returns
The free RAM reported by OS in bytes.
See also
availablePhysical.

Definition at line 104 of file kmemoryinfo.cpp.

◆ freeSwapFile()

quint64 KMemoryInfo::freeSwapFile ( ) const

freeSwapFile

Returns
The free swap size in bytes.

Definition at line 129 of file kmemoryinfo.cpp.

◆ isNull()

bool KMemoryInfo::isNull ( ) const

isNull

Returns
true if the class is null, otherwise false.

Definition at line 94 of file kmemoryinfo.cpp.

◆ operator!=()

bool KMemoryInfo::operator!= ( const KMemoryInfo other) const

operator !=

Returns
true if this memoryinfo is different from the other memoryinfo, otherwise false.

Definition at line 89 of file kmemoryinfo.cpp.

◆ operator=()

KMemoryInfo & KMemoryInfo::operator= ( const KMemoryInfo other)

operator = Makes a copy of the other memoryinfo and returns a reference to the copy.

Definition at line 67 of file kmemoryinfo.cpp.

◆ operator==()

bool KMemoryInfo::operator== ( const KMemoryInfo other) const

operator ==

Returns
true if this memoryinfo is equal to the other memoryinfo, otherwise false.

Definition at line 73 of file kmemoryinfo.cpp.

◆ totalPhysical()

quint64 KMemoryInfo::totalPhysical ( ) const

totalPhysical

Returns
The total system RAM in bytes.

Definition at line 99 of file kmemoryinfo.cpp.

◆ totalSwapFile()

quint64 KMemoryInfo::totalSwapFile ( ) const

totalSwapFile

Returns
The size of swap file in bytes.
Note
On an operating system where the paging file is dynamically allocated, this value can be zero when no memory pages are swapped.

Definition at line 124 of file kmemoryinfo.cpp.


The documentation for this class was generated from the following files:
The KMemoryInfo class provides an interface to get memory information (RAM/SWAP).
Definition: kmemoryinfo.h:30
bool isNull() const
isNull
Definition: kmemoryinfo.cpp:94
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sun Dec 4 2022 04:08:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.