glearn.Memory.stop#

Memory.stop()#

Stops recording memory change in the current process.

Note

This method should be called after glearn.Memory.start() is called.

Examples

>>> # Create an object of Memory class
>>> from glearn import Memory
>>> mem = Memory()

>>> # Create a matrix
>>> from imate import toeplitz, logdet
>>> A = toeplitz(2, 1, size=1000, gram=True)

>>> # Start tracking memory change from here
>>> mem.start()

>>> # Compute the log-determinant of the matrix
>>> ld = logdet(A)

>>> # Stop tracking memory change from here
>>> mem.stop()

>>> # Read acquired memory is acquired from start to this point
>>> mem.get_mem()
(679936, 'b')

>>> # Or, read acquired memory in human-readable format
>>> mem.get_mem(human_readable=True)
(664.0, 'Kb')