我在Ubuntu 12.04(精确)64位上使用R 2.15.3。 如果我在Valgrind的运行R:我的R有内存泄漏?
[R -d “的valgrind” --vanilla
然后我用Q()退出程序,我得到了以下报告:
==7167== HEAP SUMMARY:
==7167== in use at exit: 28,239,464 bytes in 12,512 blocks
==7167== total heap usage: 28,780 allocs, 16,268 frees, 46,316,337 bytes allocated
==7167==
==7167== LEAK SUMMARY:
==7167== definitely lost: 120 bytes in 2 blocks
==7167== indirectly lost: 480 bytes in 20 blocks
==7167== possibly lost: 0 bytes in 0 blocks
==7167== still reachable: 28,238,864 bytes in 12,490 blocks
==7167== suppressed: 0 bytes in 0 blocks
==7167== Rerun with --leak-check=full to see details of leaked memory
==7167==
==7167== For counts of detected and suppressed errors, rerun with: -v
==7167== Use --track-origins=yes to see where uninitialised values come from
==7167== ERROR SUMMARY: 385 errors from 5 contexts (suppressed: 2 from 2)
近来[R经常崩溃,特别是当我通过Rcpp调用C++函数时, 可能是这个原因吗? 谢谢!
谢谢!我发现valgrind的输出很混乱。我开始怀疑泄漏,因为只是调用一个Rcpp函数,例如: NumericMatrix myMat(int nCols,int nRows) NumericMatrix out(nRows,nCols); 退货; } 有时会导致R与segfault崩溃,如果我在R循环中迭代调用此函数: for(ii in 1:10^6)mat < - myMat(100,100) – 2013-05-03 15:52:06
如果您可以重现段错误,也许可以在'gdb'下运行,那么我们可以改进一些东西。否则,这几乎是不可能的。 – 2013-05-03 16:36:21
你是对的,如果我设法重现错误,我会在另一个问题中发布它。谢谢 – 2013-05-03 17:26:18