[Rcpp-devel] tracking volatile bug
William Dunlap
wdunlap at tibco.com
Tue Nov 18 20:46:13 CET 2014
> I will try "gctorture(TRUE)" suggested by Martin.
Try running it under valgrind as well. E.g.,
% R --debugger=valgrind
==15338== Memcheck, a memory error detector
==15338== Copyright (C) 2002-2011, and GNU GPL'd, by Julian Seward et al.
==15338== Using Valgrind-3.7.0 and LibVEX; rerun with -h for copyright
info
==15338== Command: /opt/sw/R/R-3.1.1.atlas1/lib/R/bin/exec/R
==15338==
==15338== Conditional jump or move depends on uninitialised value(s)
==15338== at 0x40188B6: index (strchr.S:56)
==15338== by 0x4007C92: expand_dynamic_string_token (dl-load.c:431)
==15338== by 0x40085EE: _dl_map_object (dl-load.c:2501)
==15338== by 0x400188D: map_doit (rtld.c:633)
==15338== by 0x400F175: _dl_catch_error (dl-error.c:178)
...
> gctorture(TRUE)
> # call your test code here
Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Nov 18, 2014 at 10:10 AM, Serguei Sokol <serguei.sokol at gmail.com>
wrote:
> Le 18/11/2014 16:39, Romain François a écrit :
>
>>
>> Le 18 nov. 2014 à 14:42, Serguei Sokol <serguei.sokol at gmail.com> a
>>> écrit :
>>>
>>> /* call this R command: source("FileName") */
>>> int errorOccurred;
>>> SEXP e = lang2(install("source"), mkString("FileName"));
>>> /* mkChar instead of mkString would lead to this runtime error:
>>> * Error in source(FileName) : unimplemented type 'char' in
>>> 'eval' */
>>> R_tryEval(e, R_GlobalEnv, &errorOccurred);
>>>
>>
>> e is not protected here. Does the problem go away if you protect it:
>>
>> SEXP e = PROTECT( lang2(install("source"), mkString("FileName"))) ;
>>
> you mean
> SEXP e = PROTECT(lang2(install("source"), mkChar("expm.higham.R")));
> (because mkString() had no problem)?
> No, it does not, the problem is still there.
>
>
>>
>> Or more R/C++ idiomatically, which is both nicer and safer.
>>
>> Language e( "source", "FileName" ) ;
>>
> This works as expected. We can suppose that behind the stage
> "FileName" is wrap()-ed here with mkString() and not with mkChar().
> That's why it's working.
>
>
>> which suggests that somewhere in Rcpp or RcppArmadillo there is
>>> a mkChar() call instead of mkString().
>>>
>>> Other times, error message can say something like
>>> "argument type[1]='x' must be one of 'M','1','O','I','F' or 'E'"
>>> or "argument type[1]='character' must be a one-letter character string"
>>> This latter message is somewhat volatile per se. The part of message
>>> just after "type[1]=" can be 'character' (as above) or 'method' or 'ANY'
>>> etc.
>>>
>>
>> That kind of problem usually is related to premature GC.
>>
> I will try "gctorture(TRUE)" suggested by Martin.
>
> Thanks,
> Serguei.
> _______________________________________________
> Rcpp-devel mailing list
> Rcpp-devel at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20141118/f0296d08/attachment-0001.html>
More information about the Rcpp-devel
mailing list