module documentation

Utility for dumping memory usage stats. This is tailored to mypy and knows (a little) about which list objects are owned by particular AST nodes, etc.

Function collect_memory_stats Return stats about memory use.
Function find_recursive_objects Find additional objects referenced by objs and append them to objs.
Function print_memory_profile Undocumented
def collect_memory_stats() -> tuple[dict[str, int], dict[str, int]]: (source)

Return stats about memory use. Return a tuple with these items: - Dict from object kind to number of instances of that kind - Dict from object kind to total bytes used by all instances of that kind

def find_recursive_objects(objs: list[object]): (source)

Find additional objects referenced by objs and append them to objs. We use this since gc.get_objects() does not return objects without pointers in them such as strings.

def print_memory_profile(run_gc: bool = True): (source)

Undocumented