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()) {
...
}
The KMemoryInfo class provides an interface to get memory information (RAM/SWAP).
Definition kmemoryinfo.h:31
bool isNull() const
isNull
Since
5.95

Definition at line 30 of file kmemoryinfo.h.

Constructor & Destructor Documentation

◆ ~KMemoryInfo()

KMemoryInfo::~KMemoryInfo ( )

Definition at line 67 of file kmemoryinfo.cpp.

◆ 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 61 of file kmemoryinfo.cpp.

◆ KMemoryInfo() [2/2]

KMemoryInfo::KMemoryInfo ( const KMemoryInfo & other)

KMemoryInfo Constructs a copy of the other memoryinfo.

Definition at line 71 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 118 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 128 of file kmemoryinfo.cpp.

◆ cached()

quint64 KMemoryInfo::cached ( ) const

cached

Returns
The size of RAM used as cache in bytes.

Definition at line 123 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 113 of file kmemoryinfo.cpp.

◆ freeSwapFile()

quint64 KMemoryInfo::freeSwapFile ( ) const

freeSwapFile

Returns
The free swap size in bytes.

Definition at line 138 of file kmemoryinfo.cpp.

◆ isNull()

bool KMemoryInfo::isNull ( ) const

isNull

Returns
true if the class is null, otherwise false.

Definition at line 103 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 98 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 76 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 82 of file kmemoryinfo.cpp.

◆ totalPhysical()

quint64 KMemoryInfo::totalPhysical ( ) const

totalPhysical

Returns
The total system RAM in bytes.

Definition at line 108 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 133 of file kmemoryinfo.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:24 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.