I would like to know how much memory is being occupied by a variable.
Let us assume this example:
import numpy as np
t = [np.random.rand(10000) for _ in range(1000)]
How much memory in megabytes is t
occupying?
I ran:
sys.getsizeof(array_list)
and I am getting 8856
which seems low for the amount of information contained in t
Best Regards.
>Solution :
from pympler import asizeof
asizeof.asizeof([np.random.rand(10000) for _ in range(1000)])
#output
80120872
Link : https://pypi.org/project/Pympler/
pip install Pympler