Startonix / Modular-AI

Advanced AI Training and Building Repository
0 stars 0 forks source link

Memory Management #160

Open Startonix opened 5 months ago

Startonix commented 5 months ago

memory_management.py

import tracemalloc

Start memory profiling

tracemalloc.start()

Code that uses memory

data = [i for i in range(1000000)]

Stop memory profiling and display results

snapshot = tracemalloc.take_snapshot() top_stats = snapshot.statistics('lineno') print(top_stats[0])