<div dir="ltr">Have you tried running your code on the Mac after setting gctorture(TRUE)?<div><br></div><div>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.</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature">Bill Dunlap<br>TIBCO Software<br>wdunlap <a href="http://tibco.com" target="_blank">tibco.com</a></div></div>
<br><div class="gmail_quote">On Thu, Aug 11, 2016 at 8:28 AM, Rajen Shah <span dir="ltr"><<a href="mailto:rds37@cam.ac.uk" target="_blank">rds37@cam.ac.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Many thanks Bill and Dirk.<div><br></div><div>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.</div><div><br></div><div>Best wishes,</div><div><br></div><div>Rajen</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On 11 August 2016 at 10:18, Dirk Eddelbuettel <span dir="ltr"><<a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
To follow-up, if we avoid the cast this works just find as you'd expect:<br>
<br>
R> cppFunction("NumericVector myrunif() { return floor(runif(1000000)); }")<br>
R> for (i in 1:100) ignoreme <- myrunif()<br>
R><br>
<span><font color="#888888"><br>
Dirk<br>
</font></span><div><div><br>
--<br>
<a href="http://dirk.eddelbuettel.com" rel="noreferrer" target="_blank">http://dirk.eddelbuettel.com</a> | @eddelbuettel | <a href="mailto:edd@debian.org" target="_blank">edd@debian.org</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>