showObjectsSize shows how much memory do objects in specific environment(s) occupy. It builds upon object.size and gathers information about the size and mode of objects in specific environment(s). It supports environment name filtering using regular expressions, object mode filtering, as well as filtering by size.

showObjectsSize(mode = NULL, n = 20, env = parent.frame(), recursive = FALSE,
    envNameRegexpr = NULL, all.names = TRUE, sizeUnits = 1024 *
        1024, verbose = FALSE)

Arguments

mode

mode of objects to show (see 'mode'), use codeNULL to show objects of all modes.

n

number of objects to show (the first n biggest objects will be shown).

env

environment to operate in.

recursive

shall we iteratively look in parent environments?

envNameRegexpr

regular expression character filter applied to the names of environments. If not NULL, only environments matched by envNameRegexpr are considered.

all.names

if TRUE, all object names are returned. If FALSE, names which begin with a '.' are omitted.

sizeUnits

the units of size (defaults to 1MB)

verbose

if TRUE, progress is reported.

Details

Partially based on http://jeromyanglim.blogspot.cz/2009/11/memory-management-in-r-few-tips-and.html.

Value

A data frame of columns name, size, mode, and env. In addition, the total size of all objects found is put into the totalSize attribute of the data frame.

See also

Examples

showObjectsSize(n=20)
#> [1] name size type mode class rows cols env #> <0 rows> (or 0-length row.names)
if (require('MASS')) { showObjectsSize(mode = 'numeric', envNameRegexpr = glob2rx('package:MASS'), rec = TRUE) }
#> name size type mode class rows cols env #> 18 SP500 0.0212554932 double numeric numeric 2780 NA package:MASS #> 59 drivers 0.0019073486 double numeric ts 192 NA package:MASS #> 28 accdeaths 0.0009918213 double numeric ts 72 NA package:MASS #> 56 deaths 0.0009918213 double numeric ts 72 NA package:MASS #> 72 galaxies 0.0006713867 double numeric numeric 82 NA package:MASS #> 119 newcomb 0.0005493164 double numeric numeric 66 NA package:MASS #> 27 abbey 0.0002822876 double numeric numeric 31 NA package:MASS #> 45 chem 0.0002288818 double numeric numeric 24 NA package:MASS #> 145 shrimp 0.0001831055 double numeric numeric 18 NA package:MASS #> 7 DDT 0.0001678467 double numeric numeric 15 NA package:MASS