Learn R Programming

fritools (version 4.6.0)

memory_hogs: Find Memory Hogs

Description

List objects in an R environment by size.

Usage

memory_hogs(
  unit = c("b", "Kb", "Mb", "Gb", "Tb", "Pb"),
  return_numeric = TRUE,
  ...,
  envir = parent.frame()
)

Value

A named vector of memory usages.

Arguments

unit

The unit to use.

return_numeric

Return a numeric vector? If set to FALSE, a character vector including the unit will be returned, which might be less usable but easier to read.

...

Arguments passed to order, defaults to decreasing = FALSE.

envir

The environment where to look for objects.

See Also

Other R memory functions: wipe_clean(), wipe_tempdir()

Examples

Run this code
va <- rep(mtcars, 1)
vb <- rep(mtcars, 1000)
vc <- rep(mtcars, 2000)
vd <- rep(mtcars, 100)
memory_hogs()
memory_hogs(unit = "Mb", decreasing = TRUE)
memory_hogs(unit = "Mb", decreasing = TRUE, return_numeric = FALSE)

Run the code above in your browser using DataLab