我正在尝试使用分析来查看我的代码的哪一部分负责最大使用 3GB 内存(如gc()
最大使用内存统计报告所示,请参阅此处如何)。我正在运行这样的内存分析:
Rprof(line.profiling = TRUE, memory.profiling = TRUE)
graf(...) # ... here I run the profiled code
Rprof(NULL)
summaryRprof(lines = "both", memory = "both")
Run Code Online (Sandbox Code Playgroud)
输出如下:
$by.total
total.time total.pct mem.total self.time self.pct
"graf" 299.12 99.69 50814.4 0.02 0.01
#2 299.12 99.69 50814.4 0.00 0.00
"graf.fit.laplace" 299.06 99.67 50787.2 0.00 0.00
"doTryCatch" 103.42 34.47 4339.2 0.00 0.00
"chol" 103.42 34.47 4339.2 0.00 0.00
"tryCatch" 103.42 34.47 4339.2 0.00 0.00
"tryCatchList" 103.42 34.47 4339.2 0.00 0.00
"tryCatchOne" 103.42 …
Run Code Online (Sandbox Code Playgroud)