kaneplusplus / bigmemory

126 stars 24 forks source link

Resource leak when shared big.matrix used with multicore #31

Closed kaneplusplus closed 8 years ago

kaneplusplus commented 9 years ago
library(bigmemory)
library(doMC)
registerDoMC(cores=2)
a = big.matrix(nrow=3, ncol=3, shared=TRUE)
desc = describe(a)
foreach (i=1:3) %dopar% {
  m = attach.big.matrix(desc)
  m[i,1] = i
  NULL
}

causes a shared memory resource leak. The following does not.

library(bigmemory)
library(doMC)
registerDoMC(cores=2)
a = big.matrix(nrow=3, ncol=3, shared=TRUE)
desc = describe(a)
foreach (i=1:3) %dopar% {
  m = attach.big.matrix(desc)
  m[i,1] = i
  rm(m)
  gc()
  NULL
}