> On 23 May 2017, at 23:40 , Merlise Clyde, Ph.D. <cl...@duke.edu> wrote: > > I am trying to resolve the Additional Issues reported by CRAN @ > https://www.stats.ox.ac.uk/pub/bdr/memtests/valgrind/BAS-Ex.Rout for my > package BAS which calls C and Fortran. > > The output from the above URL is not particularly informative (at least to > me) for identifying where the problems are in the source code, as there are > missing file names and line numbers as seen in this snippet from the above > url: >
The first of those traces does actually point to something that should be useful to you: > cleanEx() ==9861== Conditional jump or move depends on uninitialised value(s) ==9861== at 0x403DBF3: ??? ==9861== by 0x1702DE57: ??? ==9861== by 0x1702DE57: ??? ==9861== by 0x1702DE73: ??? ==9861== by 0xFFEFF861F: ??? ==9861== Uninitialised value was created by a heap allocation ==9861== at 0x4C2BBAD: malloc (/builddir/build/BUILD/valgrind-3.11.0/coregrind/m_replacemalloc/vg_replace_malloc.c:299) ==9861== by 0x4E5AFE: GetNewPage (svn/R-devel/src/main/memory.c:875) ==9861== by 0x4E77AF: Rf_allocVector3 (svn/R-devel/src/main/memory.c:2651) ==9861== by 0x14B29729: sampleworep (packages/tests-vg/BAS/src/sampleworep.c:395) ==9861== by 0x47C36D: R_doDotCall (svn/R-devel/src/main/dotcode.c:617) i.e. you are allocating something at sampleworep.c:395 but it isn't initialized before something somewhere uses its value to make a decision. So possibly you should initialize the vector immediately after allocation. In the other cases, you seem to be too deep in R internals to let you see the origin in your package, i.e., your stack traces are too short. According to the Valgrind FAQ, you can use --num-callers to make them longer. Figuring out how to pass that to valgrind as invoked by R is, um, left as an exercise for the reader. -pd > >> cleanEx() > ==9861== Conditional jump or move depends on uninitialised value(s) > ==9861== at 0x403DBF3: ??? > ==9861== by 0x1A694397: ??? > ==9861== by 0x1A694397: ??? > ==9861== by 0x1A6943B3: ??? > ==9861== by 0xFFEFF861F: ??? > ==9861== Uninitialised value was created by a heap allocation > ==9861== at 0x4C2BBAD: malloc > (/builddir/build/BUILD/valgrind-3.11.0/coregrind/m_replacemalloc/vg_replace_malloc.c:299) > ==9861== by 0x4E5AFE: GetNewPage (svn/R-devel/src/main/memory.c:875) > ==9861== by 0x4E77AF: Rf_allocVector3 (svn/R-devel/src/main/memory.c:2651) > ==9861== by 0x4E79A8: Rf_allocVector > (svn/R-devel/src/include/Rinlinedfuns.h:196) > ==9861== by 0x4E79A8: R_alloc (svn/R-devel/src/main/memory.c:2160) > ==9861== by 0x540C52: logicalSubscript > (svn/R-devel/src/main/subscript.c:563) > ==9861== by 0x5437BE: realSubscript (svn/R-devel/src/main/subscript.c:723) > ==9861== by 0x5437BE: Rf_makeSubscript > (svn/R-devel/src/main/subscript.c:980) > ==9861== by 0x5455AB: VectorSubset (svn/R-devel/src/main/subset.c:188) > ==9861== by 0x5455AB: do_subset_dflt (svn/R-devel/src/main/subset.c:826) > ==9861== by 0x4A8539: VECSUBSET_PTR (svn/R-devel/src/main/eval.c:5179) > ==9861== by 0x4A8539: bcEval (svn/R-devel/src/main/eval.c:6618) > ==9861== by 0x4B685F: Rf_eval (svn/R-devel/src/main/eval.c:624) > ==9861== by 0x4B894E: R_execClosure (svn/R-devel/src/main/eval.c:1614) > ==9861== by 0x4EA827: dispatchMethod (svn/R-devel/src/main/objects.c:335) > ==9861== by 0x4EAC12: Rf_usemethod (svn/R-devel/src/main/objects.c:375) > ==9861== > > > > To see if I could replicate locally and debug, I have built R 3.4.0 with > valgrind-3.11.0 on FC 23 using the configuration options > > ./configure --with-valgrind-instrumentation=2 > --with-system-valgrind-headers=yes CFLAGS='-g -O0' FCFLAGS='-g -O0’ > > My package is built also using -g and -O0 for debugging and turning off > optimization. > > Running valgrind on the output from examples/vignettes from R CMD check > > R -d "valgrind --tool=memcheck --leak-check=full --track-origins=yes" > --vanilla < BAS.Rcheck/BAS-Ex.R > > produces similar output as from CRAN - i.e. no line numbers to code (I have > also tried travis-CI which indicates no problems and R-devel under docker > which also replicates the non informative messages of CRAN :-) so clearly > missing something to produce the line numbers. > > Questions: > > > 1) Are these problems with libraries outside of my code or fortran and I > can ask CRAN to ignore? How can I tell if these are problems with system > libraries (i.e. configuration on my system, but also those for CRAN) rather > than my package code? > > 2) Any suggestions for other configuration options (system, R, package. > valgrind) that would provide more informative output? > (for Fedora or any other platforms using docker) > > 3) Any alternative methods recommended for tracking this down instead of > using valgrind? > > > > Thanks! > Merlise > >> sessionInfo() > R version 3.4.0 (2017-04-21) > Platform: x86_64-pc-linux-gnu (64-bit) > Running under: Fedora 23 (Twenty Three) > > Matrix products: default > BLAS: /usr/local/lib64/R/lib/libRblas.so > LAPACK: /usr/local/lib64/R/lib/libRlapack.so > > > source code is at http://github.com/merliseclyde/BAS > > > > Merlise A Clyde > Professor & Chair Department of Statistical Science > Duke University > http://stat.duke.edu/~clyde > > cl...@duke.edu<mailto:cl...@duke.edu> > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-package-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-package-devel -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Office: A 4.23 Email: pd....@cbs.dk Priv: pda...@gmail.com ______________________________________________ R-package-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-package-devel