peakmem: Compute peak memory used by a R script

Description Usage Arguments Value

View source: R/peakmem.R


The function runs the script using Rscript program in a different process and uses a python utility 'memusg' ( to measure the peak memory usage by the prcocess and its child processes. This will be helpful in measuring the memory usage of code involving parallel processing. For example, code involving ‘parallel::mclapply' call. Place the ’' file in '/usr/local/bin' directory and make it executable. The function is meant to measure peak memory utility in the order of GBs with long running parallel processes. For smaller processes, the overhead itself will distort the real usage. For smaller benchmarks, use 'benck::mark' or 'peakRAM::peakRAM'. For more details, its better to modify the python program.


peakmem(file, timeout = Inf)



Location of script


Timeout for the process, in seconds, or as a difftime object. If it is not finished before this, it will be killed.


Maximum memory used in GB

talegari/sidekicks documentation built on Sept. 26, 2018, 4:18 p.m.