Skip to content

Commit 9ba7735

Browse files
committed
add OutputRecord.still_reachable()
1 parent 4132ed5 commit 9ba7735

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

mp_reader/malloc_stats.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,12 @@ def get_memory_over_time(self) -> tuple[
510510
byte_counts[i] = living_bytes
511511
return (alloc_counts, byte_counts)
512512

513+
def still_reachable(self) -> tuple[int, int]:
514+
"""Return the number of allocations and bytes for which a free event was not recorded"""
515+
516+
alloc_counts, byte_counts = self.get_memory_over_time()
517+
return int(alloc_counts[-1]), int(byte_counts[-1])
518+
513519
@dataclass
514520
class ObjectTree:
515521
type_name: str

0 commit comments

Comments
 (0)