\HeaderA{object.size}{Report the Space Allocated for an Object}{object.size}
\keyword{utilities}{object.size}
\begin{Description}\relax
Provides an estimate of the memory that is being used to store an \R{} object.
\end{Description}
\begin{Usage}
\begin{verbatim}
object.size(x)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] An \R{} object.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
Exactly which parts of the memory allocation should be attributed to
which object is not clear-cut.  This function merely provides a rough
indication: it should be reasonably accurate for atomic vectors, but
does not detect if elements of a list are shared, for example. (As
from \R{} 2.0.0 sharing amongst elements of a character vector is taken
into account.)

The calculation is of the size of the object, and excludes the space
needed to store its name in the symbol table.

Object sizes are larger on 64-bit platforms than 32-bit ones, but will
very likely be the same on different platforms with the same word length.
\end{Details}
\begin{Value}
An estimate of the memory allocation attributable to the object, in bytes.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{Memory-limits}{Memory.Rdash.limits}} for the design limitations on object size.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
object.size(letters)
object.size(ls)
## find the 10 largest objects in base
z <- sapply(ls("package:base"), function(x) object.size(get(x, envir=NULL)))
as.matrix(rev(sort(z))[1:10])
\end{ExampleCode}
\end{Examples}

