I realise there is a helpful section on this in https://cran.r-project.org/doc/manuals/r-release/R-exts.html#Checking-memory-access
which I'm now reading. Thanks for your help. Best, Rajen On 11 August 2016 at 10:45, Rajen Shah <rd...@cam.ac.uk> wrote: > > Have you tried running your code on the Mac after setting > gctorture(TRUE)? > > No I have not tried this (and no longer have the Mac available > unfortunately). I have a very limited understanding of memory management, > but I guess you're suggesting setting this to TRUE would make sure that > freed memory really is free, and so would help uncover an issue where the > code tries to use memory that it has declared free? > > > 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. > > I am unfamiliar with how to interpret valgrid output, but are you deducing > this from "allocs > frees"? > > Thanks: a useful way of finding the most horrible memory issue bugs it > seems. > > Rajen > > On 11 August 2016 at 10:33, William Dunlap <wdun...@tibco.com> wrote: > >> 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 <rd...@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 <e...@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 | e...@debian.org >>>> >>> >>> >> >
_______________________________________________ Rcpp-devel mailing list Rcpp-devel@lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel