profmem {matter} | R Documentation

## Profile Memory Use

### Description

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

### Usage

    profmem(expr)

    mem(x, reset = FALSE)

### Arguments

`expr` | An expression to be evaluated.
`x` | An object, to identify how much memory it is using.
`reset` | Should the maximum memory used by R be reset?

### Details

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

### Value

For `profmem`, 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)

    profmem(mean(x + 1))

[Package matter version 1.6.0 Index]