detkit.Memory.peak#

Memory.peak()#

Inquiry peak memory allocation since memory is set.

Returns:
peak_memfloat

The peak memory allocation since calling detkit.Memory.set() divided by the specified unit of memory.

See also

set
now

Examples

>>> from detkit import Memory, memdet
>>> import numpy

>>> # Create a random matrix
>>> A = numpy.random.randn(10000, 10000)

>>> # Initialize with KB unit
>>> mem = Memory(unit='KB')

>>> # Set the starting point of memory inquiry
>>> mem.set()

>>> # Perform a memory-intensive operation
>>> ld = memdet(A)

>>> # Inquiry the peak allocated memory in KB unit
>>> print(mem.peak())
781489.4