Objets/Documentation
allocations32.py
Distinguer les allocations encore vivantes · allocations32.py
Télécharger ↓"""Live retained traced allocations by source line, in fresh processes at each read."""
import json,platform,subprocess,sys,tracemalloc
from pathlib import Path
from collecte24 import measure
def snapshot(cap,mode,read):
p=Path(__file__).with_name('collecte24.py').resolve()
lines=p.read_text(encoding='utf8').splitlines()
groups={}
def observe(i):
if i!=read:return
snap=tracemalloc.take_snapshot()
for st in snap.statistics('lineno'):
frame=st.traceback[0];label='other'
if Path(frame.filename)==p:
line=lines[frame.lineno-1].strip()