I want to get the memory usage of all lists in the current environment. data.table
has tables
that summarizes all tables in memory including size. Here's what I am using right now but I'm wondering if there's a better way to do it:
sapply(ls()[grepl("list",sapply(ls(), function(z) class(get(z))))],
function(z) format(object.size(get(z)), units = "Mb") )
I've seen Determining memory usage of objects? and Tricks to manage the available memory in an R session but they seem more about knowing usage of a specific item or managing memory, respectively. What I want is to get memory usage for all lists (this example) or all items that follow a certain naming convention. thanks!