
Debugging and Profiling 293
user system elapsed
1.817 0.635 2.455
> system.time(mad(runif(10000000)))
user system elapsed
2.003 0.632 2.638
The optional argument gcFirst is TRUE by default and ensures that R’s
garbage collector is run prior to the evaluation of the supplied expression. By
running the garbage collector first, it is likely that more consistent timings
will be produced.
9.6 Managing memory
There are some tools available in R to monitor memory usage. In R, memory
is divided into two separate components: memory for atomic vectors (e.g.,
integers, characters) and language elements. The language elements are the
SEXPs described in Chapter 6, while ...