[Rcpp-devel] Rcpp example that crashes on 64 bit Windows

William Dunlap wdunlap at tibco.com
Thu Aug 11 17:33:29 CEST 2016


Have you tried running your code on the Mac after setting gctorture(TRUE)?

By the way, valgrind showed the opposite of a memory leak - the code was
using memory that it had declared free.  A leak is when the code does not
free memory that it can no longer use.

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Thu, Aug 11, 2016 at 8:28 AM, Rajen Shah <rds37 at cam.ac.uk> wrote:

> Many thanks Bill and Dirk.
>
> I'm now explicitly casting each element and this works fine. I was just
> surprised that this inappropriate use of wrap would cause a memory leak on
> certain OS's and run without problems on others.
>
> Best wishes,
>
> Rajen
>
> On 11 August 2016 at 10:18, Dirk Eddelbuettel <edd at debian.org> wrote:
>
>>
>> To follow-up, if we avoid the cast this works just find as you'd expect:
>>
>> R> cppFunction("NumericVector myrunif() { return floor(runif(1000000));
>> }")
>> R> for (i in 1:100) ignoreme <- myrunif()
>> R>
>>
>> Dirk
>>
>> --
>> http://dirk.eddelbuettel.com | @eddelbuettel | edd at debian.org
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20160811/dca101dd/attachment.html>


More information about the Rcpp-devel mailing list