title: R code failed with: "Error: cannot allocate buffer"
body: <p>Compiling an RMarkdown script overnight failed with the message: </p>
  
  <blockquote>
    <p>Error: cannot allocate buffer<br>
    Execution halted</p>
  </blockquote>
  
  <p>The code chunk that it died on was while training a caretEnsemble list of 10 machine learning algorithms. I know it takes a fair bit of RAM and computing time, but I did previously succeed to run that same code in the console. Why did it fail in RMarkdown? I'm fairly sure that even if it ran out of free RAM, there was enough swap.</p>
  
  <p>I'm running Ubuntu with 3GB RAM and 4GB swap.</p>
  
  <p>I found a blog article about memory limits in R, but it only applies to Windows: <a href="http://www.r-bloggers.com/memory-limit-management-in-r/" rel="nofollow">http://www.r-bloggers.com/memory-limit-management-in-r/</a></p>
  
  <p>Any ideas on solving/avoiding this problem?</p>