detkit.Memory.set#
- Memory.set()#
Set or reset tracing allocated memory.
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 current allocated memory in KB unit >>> print(mem.now()) 781489.4 >>> # Reset the memory counter and inquiry again >>> mem.set() >>> print(mem.now()) 0.1