用valgrind检查我的程序包会产生大量与我的代码无关的错误

时间:2019-02-07 19:32:36

标签: r valgrind r-package

当我在一个空的R文件上运行valgrind时,我会看到一整页的错误信息(请参阅结尾)。

R -d "valgrind --tool=memcheck --leak-check=full" --vanilla -f empty.R

当我在调用任何C ++代码的文件上运行valgrind时,我会看到另一整页错误(请参阅结尾)。例如,仅使用此类R文件:

Rcpp::sourceCpp(code='
  #include <Rcpp.h>
  // [[Rcpp::export]]
  void f() {return; }'
)

因此,当我使用valgrind测试我的软件包时,我有一个庞大的报告,其中包含8000个与我的代码无关的错误。问题是,在这份庞大的报告中,可能有一些问题是我的错。

确实发生了这种情况,我想念自己在混乱中迷失的问题,我收到了CRAN的一封电子邮件,告诉我他们确实有更好的事情要做

足够公平,这的确是我的错,但您可能承认这些条件很难找到。无论如何,我想了解是否可以过滤valgrind报告以使内容易于阅读并且不会错过自己的错误。为什么我会一团糟?我需要重新安装R吗?我认为这是从R 3.5开始发生的,在此之前我的valgrind报告是清晰的(据valgrind报告可以清晰...)


在空文件上运行valgrind

> R -d "valgrind --tool=memcheck --leak-check=full" --vanilla -f empty.R
==31596== Memcheck, a memory error detector
==31596== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==31596== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==31596== Command: /usr/lib/R/bin/exec/R --vanilla -f test-rlas.R
==31596== 
==31596== Conditional jump or move depends on uninitialised value(s)
==31596==    at 0x5646E77: __wcsnlen_avx2 (strlen-avx2.S:261)
==31596==    by 0x5574EC1: wcsrtombs (wcsrtombs.c:104)
==31596==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31596==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31596== 
==31596== Conditional jump or move depends on uninitialised value(s)
==31596==    at 0x54DE408: internal_utf8_loop (loop.c:298)
==31596==    by 0x54DE408: __gconv_transform_internal_utf8 (skeleton.c:609)
==31596==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31596==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31596==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31596== 
==31596== Conditional jump or move depends on uninitialised value(s)
==31596==    at 0x54DE411: internal_utf8_loop (loop.c:303)
==31596==    by 0x54DE411: __gconv_transform_internal_utf8 (skeleton.c:609)
==31596==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31596==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31596==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31596== 
==31596== Conditional jump or move depends on uninitialised value(s)
==31596==    at 0x54DE458: internal_utf8_loop (loop.c:298)
==31596==    by 0x54DE458: __gconv_transform_internal_utf8 (skeleton.c:609)
==31596==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31596==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31596==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31596==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31596== 

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.

R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la façon de le citer dans les publications.

Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.

> 
==31596== 
==31596== HEAP SUMMARY:
==31596==     in use at exit: 37,855,581 bytes in 8,137 blocks
==31596==   total heap usage: 20,280 allocs, 12,143 frees, 61,112,144 bytes allocated
==31596== 
==31596== LEAK SUMMARY:
==31596==    definitely lost: 0 bytes in 0 blocks
==31596==    indirectly lost: 0 bytes in 0 blocks
==31596==      possibly lost: 0 bytes in 0 blocks
==31596==    still reachable: 37,855,581 bytes in 8,137 blocks
==31596==                       of which reachable via heuristic:
==31596==                         newarray           : 4,264 bytes in 1 blocks
==31596==         suppressed: 0 bytes in 0 blocks
==31596== Reachable blocks (those to which a pointer was found) are not shown.
==31596== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==31596== 
==31596== For counts of detected and suppressed errors, rerun with: -v
==31596== Use --track-origins=yes to see where uninitialised values come from
==31596== ERROR SUMMARY: 693 errors from 4 contexts (suppressed: 0 from 0)

在上面valgrind的示例上运行Rcpp::sourceCpp

> R -d "valgrind --tool=memcheck --leak-check=full" --vanilla -f test.R
==31642== Memcheck, a memory error detector
==31642== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==31642== Using Valgrind-3.13.0 and LibVEX; rerun with -h for copyright info
==31642== Command: /usr/lib/R/bin/exec/R --vanilla -f test-rlas.R
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x5646E77: __wcsnlen_avx2 (strlen-avx2.S:261)
==31642==    by 0x5574EC1: wcsrtombs (wcsrtombs.c:104)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE408: internal_utf8_loop (loop.c:298)
==31642==    by 0x54DE408: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE411: internal_utf8_loop (loop.c:303)
==31642==    by 0x54DE411: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE458: internal_utf8_loop (loop.c:298)
==31642==    by 0x54DE458: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x509AAFC: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x50924F8: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x508FC60: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F92E22: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72DB9: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F772E7: ??? (in /usr/lib/R/lib/libR.so)
==31642== 

R version 3.5.2 (2018-12-20) -- "Eggshell Igloo"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R est un logiciel libre livré sans AUCUNE GARANTIE.
Vous pouvez le redistribuer sous certaines conditions.
Tapez 'license()' ou 'licence()' pour plus de détails.

R est un projet collaboratif avec de nombreux contributeurs.
Tapez 'contributors()' pour plus d'information et
'citation()' pour la façon de le citer dans les publications.

Tapez 'demo()' pour des démonstrations, 'help()' pour l'aide
en ligne ou 'help.start()' pour obtenir l'aide au format HTML.
Tapez 'q()' pour quitter R.

> Rcpp::sourceCpp(code='
+   #include <Rcpp.h>
+   // [[Rcpp::export]]
+   void f() {return; }'
+ )
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x5646E77: __wcsnlen_avx2 (strlen-avx2.S:261)
==31642==    by 0x5574EC1: wcsrtombs (wcsrtombs.c:104)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x4EEEDEB: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE408: internal_utf8_loop (loop.c:298)
==31642==    by 0x54DE408: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x4EEEDEB: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE411: internal_utf8_loop (loop.c:303)
==31642==    by 0x54DE411: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x4EEEDEB: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642== 
==31642== Conditional jump or move depends on uninitialised value(s)
==31642==    at 0x54DE458: internal_utf8_loop (loop.c:298)
==31642==    by 0x54DE458: __gconv_transform_internal_utf8 (skeleton.c:609)
==31642==    by 0x5574EF4: wcsrtombs (wcsrtombs.c:110)
==31642==    by 0x54FAB20: wcstombs (wcstombs.c:34)
==31642==    by 0x4EEEDEB: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F646A1: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F747CE: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F6A394: ??? (in /usr/lib/R/lib/libR.so)
==31642==    by 0x4F72BEF: Rf_eval (in /usr/lib/R/lib/libR.so)
==31642== 
> 
==31642== 
==31642== HEAP SUMMARY:
==31642==     in use at exit: 52,821,315 bytes in 10,257 blocks
==31642==   total heap usage: 32,167 allocs, 21,910 frees, 91,967,222 bytes allocated
==31642== 
==31642== LEAK SUMMARY:
==31642==    definitely lost: 0 bytes in 0 blocks
==31642==    indirectly lost: 0 bytes in 0 blocks
==31642==      possibly lost: 0 bytes in 0 blocks
==31642==    still reachable: 52,821,315 bytes in 10,257 blocks
==31642==                       of which reachable via heuristic:
==31642==                         newarray           : 4,264 bytes in 1 blocks
==31642==         suppressed: 0 bytes in 0 blocks
==31642== Reachable blocks (those to which a pointer was found) are not shown.
==31642== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==31642== 
==31642== For counts of detected and suppressed errors, rerun with: -v
==31642== Use --track-origins=yes to see where uninitialised values come from
==31642== ERROR SUMMARY: 1089 errors from 8 contexts (suppressed: 0 from 0)

0 个答案:

没有答案