[SciPy-user] weight of matrix or other object

Alexander Michael lxander.m@gmail....
Wed Jun 6 07:21:12 CDT 2007

On 6/6/07, Robert VERGNES <robert.vergnes@yahoo.fr> wrote:
> Hello,
> I have to stop calculation when my data variable reach a certain size (
> weight).
> How can i know the weight in (Kb or Mb) of an object - either a list of
> matrix or a matrix itself ?
> Best Regards
> Robert

Are you asking for the number of bytes of memory allocated for a numpy array?

In [1]: import numpy
In [2]: a = numpy.ones((2,2))
In [3]: a.nbytes
Out[3]: 32

More information about the SciPy-user mailing list