# Is it possible to find the size of a variable in a notebook?

I have a fairly large a list of matrices matsLst, which takes about 15 minutes to compute (but computes successfully each time). I can test in the notebook that the computation has happened correctly.

But when I try to write it to disk using

Export["matsLst.mx", matsLst];


the command takes hours to run. The last time the export happened successfully, it took three hours. Right now, it's still going on two hours. I know that disk space should not be a problem, because I have about 40 GB available on my disk.

But is there a way for me to find out just how large a particular variable is before I choose to write it or not? (I mean, the whole point of writing an MX file is to save the computation time later.)

You could try ByteCount[expr]. According to the documentation it gives the number of bytes used internally to store the expression.