Skip to content

Valgrind on Snow Leopard or Lion

2 messages · Ruth Ripley, Simon Urbanek

#
I have been tying to get valgrind to run on Snow Leopard and Lion 
without much success. I get reports of errors but the process tends to 
hang before exiting. It only terminates occasionally after an error. 
Thus I cannot get leak reports.

For example: if ls.r contains the one line: ls()

R -d "valgrind --tool=memcheck" --no-save < ls.r

will produce the following and hang

==32176== Memcheck, a memory error detector
==32176== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==32176== Using Valgrind-3.8.0.SVN and LibVEX; rerun with -h for 
copyright info
==32176== Command: 
/Library/Frameworks/R.framework/Resources/bin/exec/x86_64/R --vanilla
==32176==
==32176== Warning: ignored attempt to set SIGUSR2 handler in sigaction();
==32176==          the SIGUSR2 signal is used internally by Valgrind

R version 2.14.0 (2011-10-31)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

   Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
character(0)
valgrind --tool=memcheck ls

works fine. So an R problem rather than a valgrind one, I fear.

Any help would be greatly appreciated.

Thanks,

Ruth
#
Ruth,
On Nov 27, 2011, at 4:39 PM, Ruth Ripley wrote:

            
Make sure you get the latest SVN build. Valgrind releases notoriously don't work on Darwin. I had no problem using valgrind (from SVN) on both Lion an Snow Leopard (I would never use pipes to feed the code, but I tested your case and it worked).

A few usage hints: for more reliable debugging it is helpful to compile R with --with-valgrind-instrumentation=2 and typically it's a good idea to use --dsymutil=yes --read-var-info=yes --track-origins=yes on valgrind (--tool=memcheck is the default).

Cheers,
Simon