glearn.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 glearn.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, glearn.Memory.get_mem() reads the difference between the resident memory from when glearn.Memory.start() is called to the point where glearn.Memory.stop() is called, hence measures the acquired memory in between two points.

Examples

>>> # Load Memory module
>>> from glearn 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')