imate.Memory.get_resident_memory#

static Memory.get_resident_memory(human_readable=False)#

Returns the resident memory of the current process.

This method is a static method and does not require to instantiate imate.Memory class.

Parameters:
human_readablebool, default=False

If False, the output is in Bytes. If True, the output is converted to a human readable unit.

Returns:
mem_tupletuple (int, str)

A tuple consists of the resident memory together with a string indicating the unit in which the memory is reported. If human_readable is False the unit is 'b' indicating Bytes unit. If human_readable is True, other units may be used as follows:

  • "b": indicates Bytes

  • "KB": indicates Kilo-Bytes

  • "MB": indicates Mega-Bytes

  • "GB": indicates Giga-Bytes

  • "TB": indicates Tera-Bytes

  • "PB": indicates Peta-Bytes

  • "EB": indicates Exa-Bytes

  • "ZB": indicates Zetta-Bytes

  • "YB": indicates Yotta-Bytes

Notes

This function returns the resident memory that currently resides in the hardware.

Note that, in contrast, imate.Memory.read() reads the difference between the resident memory from when imate.Memory.start() is called to the point where this method is called, hence measures the acquired memory in between two points.

Examples

>>> # Load Memory module
>>> from imate import Memory

>>> # Get resident memory in bytes
>>> Memory.get_resident_memory()
(92954624, 'b')

>>> # Get resident memory in human-readable format
>>> Memory.get_resident_memory(human_readable=True)
(88.6484375, 'Mb')