def get_allocation_stats(self): """ Returns a namedtuple of (alloc, free, mi_alloc, mi_free) for count of each memory operations. """ # No init guard needed to access stats members return _nrt_mstats(alloc=_nrt.memsys_get_stats_alloc(), free=_nrt.memsys_get_stats_free(), mi_alloc=_nrt.memsys_get_stats_mi_alloc(), mi_free=_nrt.memsys_get_stats_mi_free()) # Alias to _nrt_python._MemInfo MemInfo = _nrt._MemInfo @typeof_impl.register(MemInfo) def typeof_meminfo(val, c): return types.MemInfoPointer(types.voidptr) # Create runtime _nrt.memsys_use_cpython_allocator() rtsys = _Runtime() # Install finalizer _finalize(rtsys, _Runtime.shutdown) # Avoid future use of the class del _Runtime
mi = _nrt.meminfo_alloc_safe(size) else: mi = _nrt.meminfo_alloc(size) return MemInfo(mi) def get_allocation_stats(self): """ Returns a namedtuple of (alloc, free, mi_alloc, mi_free) for count of each memory operations. """ return _nrt_mstats( alloc=_nrt.memsys_get_stats_alloc(), free=_nrt.memsys_get_stats_free(), mi_alloc=_nrt.memsys_get_stats_mi_alloc(), mi_free=_nrt.memsys_get_stats_mi_free(), ) # Alias to _nrt_python._MemInfo MemInfo = _nrt._MemInfo # Create runtime _nrt.memsys_use_cpython_allocator() rtsys = _Runtime() # Install finalizer _finalize(rtsys, _Runtime.shutdown) # Avoid future use of the class del _Runtime