object.size {base} | R Documentation |
Provides an estimate of the memory that is being used to store an R object.
object.size(x)
x |
An R object. |
Exactly which parts of the memory allocation should be attributed
to which object is not clear-cut. This function merely provides
a rough indication. For example, it will not detect if character
storage for strings are shared between identical elements (which it
will be if rep
was used, for example).
The calculation is of the size of the object, and excludes the space needed to store its name in the symbol table.
Two or more objects can be .Alias
es of each other.
object.size
will return the same information, that for the
actual object, for each of them.
An estimate memory allocation atributable to the object, in bytes.
object.size(letters) object.size(ls) ## find the 10 largest objects in base z <- sapply(ls("package:base"), function(x) object.size(get(x))) as.matrix(rev(sort(z))[1:10])