Rev 30673 | Rev 35450 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{object.size}\alias{object.size}\title{Report the Space Allocated for an Object}\description{Provides an estimate of the memory that is being used to store an \R object.}\usage{object.size(x)}\arguments{\item{x}{An \R object.}}\details{Exactly which parts of the memory allocation should be attributed towhich object is not clear-cut. This function merely provides a roughindication: it should be reasonably accurate for atomic vectors, butdoes not detect if elements of a list are shared, for example. (Asfrom \R 2.0.0 sharing amongst elements of a character vector is takeninto account.)The calculation is of the size of the object, and excludes the spaceneeded to store its name in the symbol table.Object sizes are larger on 64-bit platforms than 32-bit ones, but willvery likely be the same on different platforms with the same word length.}\value{An estimate of the memory allocation attributable to the object, in bytes.}\seealso{\code{\link{Memory-limits}} for the design limitations on object size.}\examples{object.size(letters)object.size(ls)## find the 10 largest objects in basez <- sapply(ls("package:base"), function(x) object.size(get(x, envir=NULL)))as.matrix(rev(sort(z))[1:10])}\keyword{utilities}