I have written a lengthy C function and called it in my R script within a
repeat loop, up till 5th iteration, the loop executes properly. In the 6th
iteration, my R studio crashes. The last line that is executed before the
crash is third line after the function call. In this line I am assigning a
list from the C function to an R object.
I tried debugging it using valgrind(this is the first time I am using
Valgrind), I am unable to interpret the output that i got from valgrind.
I've taken a few lines from output and pasted below, I want to know if its
a memory leak issue in the C code or the issue is in the R.
Please let me know if additional information is required and guide me
through how to debug this.
*==8061== Invalid read of size 1*
*==8061== at 0x4EC0F63: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4EC26B1: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F75B7C: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F76105: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F34D2A: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F40F2F: Rf_eval (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F4296D: Rf_applyClosure (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F3CE92: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F40F2F: Rf_eval (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F4296D: Rf_applyClosure (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F410CC: Rf_eval (in /usr/lib/R/lib/libR.so)*
*==8061== by 0x4F45CCE: ??? (in /usr/lib/R/lib/libR.so)*
*==8061== Address 0x4231f7a3c8360000 is not stack'd, malloc'd or
(recently) free'd*
*==8061==*
* *** caught segfault ****
*address (nil), cause 'unknown'*
*aborting ...*
*==8061==*
*==8061== Process terminating with default action of signal 11 (SIGSEGV)*
*==8061== at 0x53FD269: raise (pt-raise.c:35)*
*==8061== by 0x53FD38F: ??? (in /lib/x86_64-linux-gnu/libpthread-2.23.so
<http://libpthread-2.23.so/>)*
*==8061== by 0x4EC0F62: ??? (in /usr/lib/R/lib/libR.so)*
*==8061==*
*==8061== HEAP SUMMARY:*
*==8061== in use at exit: 110,953,432 bytes in 73,516 blocks*
*==8061== total heap usage: 125,391 allocs, 51,875 frees, 228,027,816
bytes allocated*
*==8061== LEAK SUMMARY:*
*==8061== definitely lost: 1,183,860 bytes in 1,355 blocks*
*==8061== indirectly lost: 1,220,908 bytes in 16,474 blocks*
*==8061== possibly lost: 2,388 bytes in 3 blocks*
*==8061== still reachable: 108,546,276 bytes in 55,684 blocks*
*==8061== suppressed: 0 bytes in 0 blocks*
*==8061==*
*==8061== For counts of detected and suppressed errors, rerun with: -v*
*==8061== ERROR SUMMARY: 38 errors from 38 contexts (suppressed: 0 from 0)*
*Segmentation fault (core dumped)*
Thanks,
Faustina
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users