<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#ffffff">
Hi guys, <br>
<br>
I have encountered a reproducible error in using Rcpp, which I have
reported below. Basically, while allocation of elements in a vector
to a particular value works well for vectors of small sizes, this
returns an error when the size of that vector is increased. Either
it returns a giblc error or it hangs and never resumes. I have
reproduced this error on two different Linux distributions (Ubuntu
10.10 and 10.04 with g++ 4.4.1 and R 2.12.1). <br>
<br>
####################################################<br>
library(Rcpp)<br>
library(inline)<br>
<br>
src <- '<br>
Rcpp::IntegerMatrix xA(A);<br>
int n=xA.nrow();<br>
NumericVector dist(n);<br>
for(int i=0;i<=n;i++){dist[i]=1.0;}<br>
return dist;'<br>
cxxfun <-
cxxfunction(sig=signature(A="matrix"),body=src,plugin="Rcpp",verbose=TRUE)<br>
<br>
## Tests.<br>
n <- 20; A <- matrix(0,n,n); dist <- cxxfun(A); <br>
n <- 200; A <- matrix(0,n,n); dist <- cxxfun(A); <br>
n <- 2000; A <- matrix(0,n,n); dist <- cxxfun(A); <br>
*** glibc detected *** /usr/lib/R/bin/exec/R: double free or
corruption (!prev): 0x08cfc278 ***<br>
<br>
####################################################<br>
<br>
Is there something that I doing wrong there? <br>
Thank you very much for your help, <br>
Ced<br>
<br>
<br>
<div class="moz-signature">-- <br>
<div class="moz-signature"><font face="Times" size="3">
Cedric Ginestet <br>
Centre for Neuroimaging Sciences (L3.04) <br>
NIHR Biomedical Research Centre <br>
Institute of Psychiatry, Box P089 <br>
Kings College London <br>
De Crespigny Park<br>
London <br>
SE5 8AF <br>
</font>
</div>
</div>
</body>
</html>