title: Memory Usage in Foreach Function
body: <p>I was wondering if there is any way to get the foreach package in R to use a pre-allocated structure to put results. basically it involves lots of small linalg operations on very big data sets.</p>
  
  <p>My non-foreach original code is something like</p>
  
  <pre><code>results &lt;- rep(NA,m*l*[big.number])
  dim(results) &lt;- c(m,l,[big.number])
  for (i in 1:m){
      for (j in 1:l){
          results[i,j,] &lt;- function(j,i,data)
      }
  }
  </code></pre>
  
  <p>I'd like to use foreach and doMC to parallelize this but test runs are really really slow and I think it's the continual data moving that rbind and c do.</p>