showObjectsSize: R object size dump.

showObjectsSizeR Documentation

R object size dump.

Description

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.

Usage

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.

Author(s)

Tomas Sieger

See Also

object.size, ls, mode

Examples

showObjectsSize(n=20)

if (require('MASS')) {
  showObjectsSize(mode = 'numeric', envNameRegexpr = glob2rx('package:MASS'), rec = TRUE)
}

tsieger/tsiMisc documentation built on Oct. 10, 2023, 10:24 p.m.