Re: [Rd] mb_m buffer not cleared if parseEval fails

From: Dirk Eddelbuettel <>
Date: Thu, 01 Mar 2012 10:39:02 -0600

Hi Pratibha,

May I suggest to move this over to the rcpp-devel list (where you need to be subscribed to post)? I am setting an appropriate Reply-To: now, we should then also remove the CC for r-devel.

On 1 March 2012 at 11:05, Pratibha Rana wrote:
| Hi,
| I am using RInside for one of the applications that I'm using. The error
| that occured is as follows.
| When I use R.parseEval("xyz") if the parse fails then the mb_m is not
| cleared and hence all subsequent
| calls to R.parseEval fail.
| example:
| when R.parseEval("stringConcatfactoryrandom") is executed the R instance
| looks like this
| (gdb) p R
| $7 = (RInside &) @0x7fff13d42d10: {mb_m = {buffer =
| "stringConcatfactoryrandom"}, global_env = <incomplete type>, verbose_m
| = false, static instance_ = 0x7fff13d42d10}
| since there's no function called stringConcatfactoryrandom in my R code,
| the above call fails. The I use the same R instance to call
We could do with a try/catch logic here. You can either (easiest) wrap your actual expression in a try() [ or tryCatch() ] and then submit the new compound expression.

Or we tackle this at the C++ and add a try/catch layer in the member function RInside::parseEval() --- which never had one as I started with the code from littler which, being C, never had this type of exception handling.

I do not have to implement this, or try it, but if you get a chance I'd love to hear how it goes.

| R.parseEval("exists") and I get this
| (gdb) p R
| $8 = (RInside &) @0x7fff13d42d10: {mb_m = {buffer =
| "stringConcatfactoryrandomexists"}, global_env = <incomplete type>,
| verbose_m = false, static instance_ = 0x7fff13d42d10}
| I think the buffer should be cleared after each call to parseEval

Other approaches may work too. What you suggest would just ignore the error and carry on. That may work too, but there is something about this I don't quite like...

Cheers, Dirk  

| Thanks
| Pratibha
| ______________________________________________
| mailing list

"Outside of a dog, a book is a man's best friend. Inside of a dog, it is too
dark to read." -- Groucho Marx

______________________________________________ mailing list
Received on Thu 01 Mar 2012 - 16:41:30 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 01 Mar 2012 - 17:30:23 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive