I have written an external C function to be called by the R .C()
function. In order to check that no memory leaks occur I make the next call using valgrind
from Ubuntu.
R --debugger=valgrind --vanilla < Desktop/eraseme.R
And I get no errors. But I do get the notification that I have a memory leak.
==16347== HEAP SUMMARY:
==16347== in use at exit: 30,440,904 bytes in 13,097 blocks
==16347== total heap usage: 29,644 allocs, 16,549 frees, 134,692,871 bytes allocated
==16347==
==16347== LEAK SUMMARY:
==16347== definitely lost: 120 bytes in 2 blocks
==16347== indirectly lost: 480 bytes in 20 blocks
==16347== possibly lost: 0 bytes in 0 blocks
==16347== still reachable: 30,440,304 bytes in 13,075 blocks
==16347== suppressed: 0 bytes in 0 blocks
==16347== Rerun with --leak-check=full to see details of leaked memory
However I do not know how to find where is the leaking coming from. The output says that I should run it with the option --leak-check=full
but that option is not available.
How can I find where is the leaking comming from? which call do I have to make to Valgrind
taking in consideration that I am running an R script?
Thank you for your time.
EDIT: When I say that the option is not available I mean that I only have this options when I look for them.
--arch --help --min-vsize --no-restore-history --silent
--args --interactive --no-environ --no-save --slave
--debugger-args --max-nsize --no-init-file --no-site-file --vanilla
--encoding --max-ppsize --no-readline --quiet --verbose
--file --max-vsize --no-restore --restore --version
--gui --min-nsize --no-restore-data --save
EDIT: so indeed R shows that memory leak even if the C()
function is correct.