object_size(letters)
object_size(ls)
# Find the 10 largest objects in the base package
allObj <- sapply(ls("package:base"), function(x)
object_size(get(x, envir=baseenv())))
(bigObj <- as.object_sizes(rev(sort(allObj))[1:10]))
print(bigObj, humanReadable=TRUE)
as.object_sizes(14567567)
oldopt <- options(humanReadable=TRUE)
(z <- object_size(letters,
c(letters, letters),
rep(letters, 100),
rep(letters, 10000)))
is.object_sizes(z)
as.object_sizes(14567567)
options(oldopt)
# Comparison
# gdata
print(object_size(loadNamespace), humanReadable=TRUE)
print(bigObj, humanReadable=TRUE)
# utils
print(utils::object.size(loadNamespace), units="auto")
sapply(bigObj, utils:::format.object_size, units="auto")
# ll
ll("package:base")[order(-ll("package:base")$KB)[1:10],]
Run the code above in your browser using DataLab