Provides an estimate of the memory that is being used to store an R object.
object.size(x) ## S3 method for class 'object_size': print((x, quote = FALSE, units = "b", ...))
- An R object.
- logical, indicating whether or not the result should be printed with surrounding quotes.
- The units to be used in printing the size. Other allowed values are
"auto"(see ‘Details’). As from R 2.14.0,
"KB"etc are also accepted.
- Arguments to be passed to or from other methods.
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. (Sharing amongst elements of a character vector is taken into account, but not that between character vectors in a single object.) The calculation is of the size of the object, and excludes the space needed to store its name in the symbol table.
Associated space (e.g. the environment of a function and what the pointer in a
EXTPTRSXP points to) is not included in the calculation.
Object sizes are larger on 64-bit builds than 32-bit ones, but will very likely be the same on different platforms with the same word length and pointer size.
An object of class
"object_size" with a length-one double value, an estimate of the memory allocation attributable to the object in bytes.
Memory-limits for the design limitations on object size.
Documentation reproduced from R 2.15.3. License: GPL-2.