getObjectSize

lsst.daf.butler.core.utils.getObjectSize(obj, seen=None)

Recursively finds size of objects.

Only works well for pure python objects. For example it does not work for Exposure objects where all the content is behind getter methods.

Parameters
objobject

Instance for which size is to be calculated.

seenset, optional

Used internally to keep track of objects already sized during recursion.

Returns
sizeint

Size in bytes.

See also

sys.getsizeof

Notes

See https://goshippo.com/blog/measure-real-size-any-python-object/