理解valgrind输出并解决错误R.

时间:2016-06-13 05:21:06

标签: r valgrind rmysql r-dbi

我正在运行一个Rscipt来计算一个循环中大约1000个城市的经济参数。数据存储在我使用RMySQL和DBI包访问的MySQL中。

但是我一直在收到分段错误错误。我不知道为什么会这样。大多数情况下脚本工作正常,但突然间它会引发分段错误错误。当我重新运行脚本时,它再次正常工作。从我能够收集它的某种记忆问题。我尝试使用valgrind进行调试,但我无法理解需要采取的输出和补救措施。

这是valgrind的输出。我想知道输出的含义和错误的位置。

==5856== Invalid read of size 1
==5856==    at 0x4F3CF17: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F3EF2B: Rf_cons (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EDF18B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EDFF66: Rf_shallow_duplicate (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EB9CBB: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F4276B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F43D24: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F019FA: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0CF6F: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F1249C: Rf_applyClosure (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D065: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D38F: ??? (in /usr/lib/R/lib/libR.so)
==5856==  Address 0x122ca7f3 is 3 bytes inside a block of size 296 free'd
==5856==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5856==    by 0x4F3D707: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F3EF2B: Rf_cons (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4E82027: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4E86414: Rf_namesgets (in /usr/lib/R/lib/libR.so)
==5856==    by 0xCB18756: RS_DBI_createNamedList (RS-DBI.c:731)
==5856==    by 0xCB1BB0B: RS_MySQL_resultSetInfo (RS-MySQL.c:1029)
==5856==    by 0x4ECD51B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D5A2: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F10955: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D38F: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F10BA1: ??? (in /usr/lib/R/lib/libR.so)
==5856== 
==5856== Invalid read of size 8
==5856==    at 0x4F3CF23: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F3EF2B: Rf_cons (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EDF18B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EDFF66: Rf_shallow_duplicate (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4EB9CBB: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F4276B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F43D24: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F019FA: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0CF6F: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F1249C: Rf_applyClosure (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D065: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D38F: ??? (in /usr/lib/R/lib/libR.so)
==5856==  Address 0x122ca808 is 24 bytes inside a block of size 296 free'd
==5856==    at 0x4C2BDEC: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==5856==    by 0x4F3D707: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F3EF2B: Rf_cons (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4E82027: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4E86414: Rf_namesgets (in /usr/lib/R/lib/libR.so)
==5856==    by 0xCB18756: RS_DBI_createNamedList (RS-DBI.c:731)
==5856==    by 0xCB1BB0B: RS_MySQL_resultSetInfo (RS-MySQL.c:1029)
==5856==    by 0x4ECD51B: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D5A2: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F10955: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F0D38F: ??? (in /usr/lib/R/lib/libR.so)
==5856==    by 0x4F10BA1: ??? (in /usr/lib/R/lib/libR.so)

这是我开始跑步时的会话信息。

R version 3.1.1 (2014-07-10)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
 [1] pryr_0.1.2         gdata_2.17.0       lubridate_1.3.3    dplyr_0.2         
 [5] DataCombine_0.1.26 quantmod_0.4-0     Defaults_1.1-1     TTR_0.22-0        
 [9] xts_0.9-7          zoo_1.7-11         RMySQL_0.9-3       DBI_0.2-7         

loaded via a namespace (and not attached):
 [1] assertthat_0.1   codetools_0.2-8  data.table_1.9.2 digest_0.6.8    
 [5] grid_3.1.1       gtools_3.5.0     lattice_0.20-31  memoise_0.2.1   
 [9] parallel_3.1.1   plyr_1.8.1       Rcpp_0.11.2      reshape2_1.4    
[13] stringr_0.6.2    tools_3.1.1     
>

0 个答案:

没有答案