Monitor memory usage in R

前端 未结 3 1038
鱼传尺愫
鱼传尺愫 2020-12-01 05:07

Is it possible to monitor the amount of memory that is in use or has been used by R to call a function? For example, I have an arbitrary function, e.g:

small         


        
3条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-01 05:53

    One option is to use Rprof. A simple approach is this:

    Rprof(tf <- "rprof.log", memory.profiling=TRUE)
    
    [your code]
    
    Rprof(NULL)
    summaryRprof(tf)
    

    This will give you some information on memory usage.

提交回复
热议问题