编辑器
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