mantidimaging.core.utility.leak_tracker module

class mantidimaging.core.utility.leak_tracker.ItemInfo(ref, msg, created)[source]

Bases: NamedTuple

created: List[str]

Alias for field number 2

msg: str

Alias for field number 1

ref: ReferenceType

Alias for field number 0

class mantidimaging.core.utility.leak_tracker.LeakTracker[source]

Bases: object

Track object to debug why large objects are still referenced.

All objects of interest should be added in their constructor. The pretty_print() method can be called later, so see some information about which of the objects are alive.

add(item, msg='')[source]
clear() None[source]
count() int[source]
live_objects() Iterable[ItemInfo][source]
pretty_print(debug_init=False, debug_owners=False, trace_depth=5, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>) None[source]
mantidimaging.core.utility.leak_tracker.find_owners(obj, depth: int, path: List[str] | None = None, ignore: Set[int] | None = None) List[List[str]][source]

Recursively track though references to objects and return a list of routes

mantidimaging.core.utility.leak_tracker.obj_to_string(obj, relative=None) str[source]

Shows object type, id and extra info for some classes