pympler.muppy

Functions

pympler.muppy.get_objects(remove_dups=True, include_frames=False)

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)

Compute the total size of all elements in objects.

pympler.muppy.get_diff(left, right)

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)

Sort objects by size in bytes.

pympler.muppy.filter(objects, Type=None, min=-1, max=-1)

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, level=1)

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.