Kasper Daniel Hansen
2010-Oct-06 13:31 UTC
[Rd] possible bug in summaryRprof with memory.profiling=TRUE
I apologize for the somewhat brief bug report, but we are getting close to the release of 2.12 and I thought it was better to send something brief than to stay silent. R version 2.12.0 beta (2010-10-06 r53205) compiled with memory-profiling enabled. I have very little experience with memory profiling, but the following works Rprof(memory.profiling = TRUE) example(glm) Rprof(NULL) summaryRprof(memory = "stats") Now, I am working on a personal function involving a number of nested functions, smoothP contains smoothChromosome contains smoothSample These functions contains a number of print(gc()) calls that I have left untouched (not sure if this is related). My code also used multicore, but currently it uses mclapply(..., mc.cores = 1) which (as far as I can see) simply calls lapply. When I run Rprof(memory.profiling = TRUE) BSdata <- smoothP(BSdata.tmp, ns = 70, h = 1000, mc.cores = 1) Rprof(NULL) summaryRprof(memory = "stats") I get an error: Error in tapply(1L:961L, list(index = c("\"smoothP\":\"print\"", "\"smoothP\":\"print\"", : arguments must have same length Enter a frame number, or 0 to exit 1: summaryRprof(memory = "stats") 2: Rprof_memory_summary(filename = con, chunksize = chunksize, aggregate = ind 3: by(memcounts, index, function(these) with(these, round(c(vsize.small = mean 4: by.data.frame(memcounts, index, function(these) with(these, round(c(vsize.s 5: eval(substitute(tapply(1:nd, IND, FUNx, simplify = simplify)), data) 6: eval(expr, envir, enclos) 7: tapply(1:961, list(index = c("\"smoothP\":\"print\"", "\"smoothP\":\"print\ Selection: 2 Called from: eval(expr, envir, enclos) Browse[1]> dim(memcounts) [1] 961 4 Browse[1]> length(index) [1] 5961 Browse[1]> head(index) [1] "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" [4] "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" Browse[1]> tail(index) [1] "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" "\"smoothP\":\"print\"" [4] "\"smoothP\":\"print\"" "\"smoothP\":\"list\"" "\"smoothP\":\"list\"" Browse[1]> The file Rprof.out has 5962 lines according to wc -l, and looks normal. The file is available at http://www.biostat.jhsph.edu/~khansen/Rprof.out It parses correctly if I just do summaryRprof() (without the memory = "stats" option). If I use memory = "tseries" I also get a row number mismatch: Error in data.frame(..., check.names = FALSE) : arguments imply differing number of rows: 961, 5961 Enter a frame number, or 0 to exit 1: summaryRprof("http://www.biostat.jhsph.edu/~khansen/Rprof.out", memory = "t 2: Rprof_memory_summary(filename = con, chunksize = chunksize, label = index, 3: cbind(memcounts, labels) 4: cbind(deparse.level, ...) 5: data.frame(..., check.names = FALSE) Selection: I see this in R-devel (build today) as well. Kasper