ByteCount

ByteCount[expr]

gives the number of bytes used internally by the Wolfram System to store expr.

Details

  • ByteCount does not take account of any sharing of subexpressions. The results it gives assume that every part of the expression is stored separately. ByteCount will therefore often give an overestimate of the amount of memory currently needed to store a particular expression. When you manipulate the expression, however, subexpressions will often stop being shared, and the amount of memory needed will be close to the value returned by ByteCount. »
  • Results from ByteCount may be different on different computer systems.

Examples

open allclose all

Basic Examples  (2)

Find the number of bytes used to store an expression:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Plot the ByteCount for different types of expressions:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=
In[3]:=
Click for copyable input
Out[3]=

Applications  (3)

Properties & Relations  (8)

Possible Issues  (2)

See Also

LeafCount  MemoryInUse  MaxMemoryUsed  Length  StringLength  Depth  Share  BitLength  Hash  Compress

Tutorials

Introduced in 1988
(1.0)