[Rcpp-devel] Fwd: Exposed class works within cpp func, bombs via module

Thell Fowler tbfowler4 at gmail.com
Wed Feb 26 19:26:39 CET 2014


resend including list

---------- Forwarded message ----------
From: Thell Fowler <tbfowler4 at gmail.com>
Date: Wed, Feb 26, 2014 at 12:25 PM
Subject: Re: [Rcpp-devel] Exposed class works within cpp func, bombs via module
To: Dirk Eddelbuettel <edd at debian.org>


On Wed, Feb 26, 2014 at 11:46 AM, Dirk Eddelbuettel <edd at debian.org> wrote:
>
> Thell,
>
> On 26 February 2014 at 09:46, Thell Fowler wrote:
> |
> | I'm getting::
> |
> | *** Error in `/usr/lib/rstudio/bin/rsession': malloc(): smallbin double linked
> | list corrupted: 0x0000000003436090 ***--
> |
> | It is a small class for iterative compositions.  It looks like there's a
> | bad_alloc between the R and C++ sides of things but I'm not quite sure what to
> | check on it.  Are there any docs going into the scoping of module exposed
> | classes?
> |
> | The example bomb is posted as a gist at:
> |
> | https://gist.github.com/Thell/9231866
>
> I only glanced at it, and my only hunch, based on fix with iterators I sent
> someone in another context just yesterday, may be that maybe something is
> going off with your use of iterators in next().
>
> Maybe worth trying as a straight vector version?  It's just guess.
>
> Dirk
>
> --
> Dirk Eddelbuettel | edd at debian.org | http://dirk.eddelbuettel.com

Dirk,

Thanks.  Indeed it looks like the state_iter is having the issue.
I've updated the gist with some cout debugging and have captured::

> C$composition()
state.begin addr: 0x2c7c1d0
state_iter addr: 0x2e23a50
state_iter type: N9__gnu_cxx17__normal_iteratorIPiSt6vectorIiSaIiEEEE
state size:3
Accessing comp sized:1
[1] 3

> # bad_alloc
> # C$advance()

begin() and state_iter _should be pointing to the same addr.  Now the
question is why it doesn't.


BTW - what was the fix/issue you tackled yesterday?  Possibly any relation?
--
Sincerely,
Thell


-- 
Sincerely,
Thell


More information about the Rcpp-devel mailing list