pympler.muppy

Functions

pympler.muppy.get_objects(remove_dups: bool = True, include_frames: bool = False) List[Any]

Return a list of all known objects excluding frame objects.

If (outer) frame objects shall be included, pass include_frames=True. In order to prevent building reference cycles, the current frame object (of the caller of get_objects) is ignored. This will not prevent creating reference cycles if the object list is passed up the call-stack. Therefore, frame objects are not included by default.

Keyword arguments: remove_dups – if True, all duplicate objects will be removed. include_frames – if True, includes frame objects.

pympler.muppy.get_size(objects: List[Any]) int

Compute the total size of all elements in objects.

pympler.muppy.get_diff(left: List[Any], right: List[Any]) Dict[str, List[Any]]

Get the difference of both lists.

The result will be a dict with this form {‘+’: [], ‘-’: []}. Items listed in ‘+’ exist only in the right list, items listed in ‘-’ exist only in the left list.

pympler.muppy.sort(objects: List[Any]) List[Any]

Sort objects by size in bytes.

pympler.muppy.filter(objects: List[Any], Type: Optional[type] = None, min: int = - 1, max: int = - 1) List[Any]

Filter objects.

The filter can be by type, minimum size, and/or maximum size.

Keyword arguments: Type – object type to filter by min – minimum object size max – maximum object size

pympler.muppy.get_referents(object: Any, level: int = 1) List[Any]

Get all referents of an object up to a certain level.

The referents will not be returned in a specific order and will not contain duplicate objects. Duplicate objects will be removed.

Keyword arguments: level – level of indirection to which referents considered.

This function is recursive.