title: "'Calloc 'could not allocate memory" in 64-bit R
body: <p>I'm on Windows Server 2012 (64-bit) with 30.5 GB of RAM, running R v3.1.2 in RStudio 0.98, and am still having trouble with R hitting a memory limit.</p>
  
  <p>I reviewed the FAQ here: <a href="http://cran.r-project.org/bin/windows/base/rw-FAQ.html#There-seems-to-be-a-limit-on-the-memory-it-uses_0021" rel="noreferrer">http://cran.r-project.org/bin/windows/base/rw-FAQ.html#There-seems-to-be-a-limit-on-the-memory-it-uses_0021</a></p>
  
  <p>Which states that the memory limit on 64-bit instances defaults to the total amount of RAM, and that the limit can be checked and set using memory.limit().</p>
  
  <p>A call to <code>memory.limit()</code> returns <code>31249</code>, confirming that it's able to see and use all 30 gigs.</p>
  
  <p>However, when I make a modeling call on a large dataset (~10M rows):</p>
  
  <pre><code>ctree(as.formula(formula), data=d, control=ctree_control(mincriterion=0.9, minbucket=1000))
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>'Calloc' could not allocate memory (18446744073673801728 of 8 bytes) 
  </code></pre>
  
  <p>But looking at the system task manager I can see that over 25GB is still available, and that R is only using 2.3GB.</p>
  
  <p>Running the modeling outside of RStudio and in R directly yields the same result, so RStudio isn't the variable.</p>
  
  <p>I'm perplexed - why does R refuse to use all my memory?</p>