memtime | R Documentation |
These are utility functions for checking memory used by objects and by R during the execution of an expression.
mem(x, reset = FALSE)
memtime(expr)
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. |
These are wrappers around the built-in gc
function. Note that they only count memory managed by R.
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).
Kylie A. Bemis
gc
,
x <- 1:100
mem(x)
memtime(mean(x + 1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.