gives the number of bytes used internally by the Wolfram System to store expr.
- 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. »
- Symbols are effectively always shared, so have a byte count of zero. »
- Results from ByteCount may be different on different computer systems.
Examplesopen allclose all
Basic Examples (2)
Plot the ByteCount for different types of expressions:
Properties & Relations (8)
ByteCount does not account for sharing in the actual storage of expressions:
For ASCII strings, ByteCount on average increases by 1 for each character:
Possible Issues (2)
ByteCount only gives the size of handles to external objects:
Wolfram Research (1988), ByteCount, Wolfram Language function, https://reference.wolfram.com/language/ref/ByteCount.html.
Wolfram Language. 1988. "ByteCount." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ByteCount.html.
Wolfram Language. (1988). ByteCount. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ByteCount.html