Skip to content

peakRAM for loops #3

@danxfreeman

Description

@danxfreeman

Thanks for developing this @tpq, I've been using it to benchmark a package I'm developing against a current one. One question though - does peakRAM work for loops? I'm trying to understand why these two calls give different outputs.

mem <- peakRAM({
  for(i in 1:10) {
    mean(rnorm(1e6))
  }
})
mem$Peak_RAM_Used_MiB # 10008235

mem <- peakRAM({
  for(i in 1:5) {
    mean(rnorm(1e6))
  }
})
mem$Peak_RAM_Used_MiB # 5006635, shouldn't this be the same?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions