memtime: Check Memory Use

View source: R/utils.R

memtimeR Documentation

Check Memory Use

Description

These are utility functions for checking memory used by objects and by R during the execution of an expression.

Usage

mem(x, reset = FALSE)

memtime(expr)

Arguments

x

An object, to identify how much memory it is using.

reset

Should the maximum memory used by R be reset?

expr

An expression to be evaluated.

Details

These are wrappers around the built-in gc function. Note that they only count memory managed by R.

Value

For memtime, a vector giving [1] the amount of memory used at the start of execution, [2] the amount of memory used at the end of execution, [3] the maximum amount of memory used during execution, [4] the memory overhead as defined by the maximum memory used minus the starting memory use, and [5] the execution time in seconds.

For mem, either a single numeric value giving the memory used by an object, or a vector providing a more readable version of the information returned by gc (see its help page for details).

Author(s)

Kylie A. Bemis

See Also

gc,

Examples

x <- 1:100

mem(x)

memtime(mean(x + 1))

kuwisdelu/matter documentation built on May 1, 2024, 5:17 a.m.