主页
Python
Python tracemalloc 模块
demo_ref_module_tracemalloc_basic
运行 ❯
×
更改方向
保存代码
更改主题
import tracemalloc tracemalloc.start() data = [i for i in range(1000)] current, peak = tracemalloc.get_traced_memory() tracemalloc.stop() print(f'Current: {current} bytes, Peak: {peak} bytes')
Current: 45056 bytes, Peak: 45376 bytes