[Rd] possible bug in summaryRprof with memory.profiling=TRUE

From: Kasper Daniel Hansen <kasperdanielhansen_at_gmail.com>
Date: Wed, 06 Oct 2010 09:31:52 -0400

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)
  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\""
[4] "\"smoothP\":\"print\"" "\"smoothP\":\"print\""
Browse[1]> tail(index)
[1] "\"smoothP\":\"print\"" "\"smoothP\":\"print\""
[4] "\"smoothP\":\"print\"" "\"smoothP\":\"list\""

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
(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)


I see this in R-devel (build today) as well.


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Wed 06 Oct 2010 - 13:39:54 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 06 Oct 2010 - 21:30:07 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive