[Rcpp-devel] Segmentation Fault on Exit of RInside-using Programs
Dirk Eddelbuettel
edd at debian.org
Fri Dec 7 19:13:32 CET 2012
Mario,
On 7 December 2012 at 12:56, Mario Bourgoin wrote:
| Dear Sir or Madam,
|
| I first noticed this problem yesterday. Every C++ program that instantiates
| RInside has a segmentation violation upon exit. (That's after doing
| everything it was supposed to do the way it was expected to do it.) What am I
| doing wrong?
Nothing, it's Rcpp 0.10.1 and the issue got fixed in the first commit _after_
finalising 0.10.1.
This was also already discussed on the very list this very week. It is also
completely harmless.
You can any one of
i) revert Rcpp to an older release
ii) upgrade Rcpp to an SVN snapshot version post 0.10.1
iii) apply the patch below.
That code has by now been rewritten by Romain anyway....
Modified: pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h
===================================================================
--- pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h 2012-11-27 01:34:59 UTC (rev 4046)
+++ pkg/Rcpp/inst/include/Rcpp/iostream/Rostream.h 2012-11-27 14:21:42 UTC (rev 4047)
@@ -38,7 +38,12 @@
std::ostream( new Rstreambuf(output) ),
buf( static_cast<Rstreambuf*>( rdbuf() ) )
{}
- ~Rostream(){ delete buf ; }
+ ~Rostream() {
+ if (buf != NULL) {
+ delete buf;
+ buf = NULL;
+ }
+ }
};
// declare global variable
[...]
|
| A minimal example is
|
| #include <RInside.h>
| int main(int argc, char *argv[]) {
| RInside R(argc, argv);
| exit(0);
| }
[..]
| I have downloaded the RInside and Rcpp sources and will reinstall them,
| hopefully without -O3 and with -g so I can get more informative results.
Just apply the patch. That will make the (scary-looking but harmless) notice
of a segfault go away.
Sorry that you had to go through all of this. Sometimes it pays to simply be
subscribed here and lurk...
Dirk
--
Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com
More information about the Rcpp-devel
mailing list