Skip to main content

Calculates an object deep size

Project description

objsize

Calculates an object deep size.

This module uses python internal GC implementation to traverse all decedent objects. It ignores type objects (isinstance(o, type)) such as classes and modules as they are common among all objects. It is implemented without recursive calls for best performance.

Usage

import numpy as np
from objsize import get_deep_obj_size

x = np.random.rand(1024).astype(np.float64)
y = np.random.rand(1024).astype(np.float64)
d = {'x': x, 'y': y}

class MyClass:
    def __init__(self, xx, yy, dd):
        self.x = xx
        self.y = yy
        self.d = dd

my_obj = MyClass(x, y, d)
get_deep_obj_size(my_obj)
# 16984

Install (beta)

python setup.py develop --user

License

GPL

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

objsize-0.1.0.tar.gz (15.9 kB view hashes)

Uploaded Source

Built Distribution

objsize-0.1.0-py2.py3-none-any.whl (2.7 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page