title: merging really not that large data.tables immediately results in R being killed
body: <p>I have 32GB of ram on this machine, but I can get R killed faster than anybody ;)   </p>
  
  <h3>example</h3>
  
  <p>The goal here is to achieve an <code>rbind()</code> of two data.tables using functions that make use of data.table's efficiency.</p>
  
  <p>input:</p>
  
  <pre><code>rm(list=ls())
  gc()
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>          used (Mb) gc trigger   (Mb)  max used   (Mb)
  Ncells 1604987 85.8    2403845  128.4   2251281  120.3
  Vcells 3019405 23.1  537019062 4097.2 468553954 3574.8
  </code></pre>
  
  <p>input:</p>
  
  <pre><code>tmp.table &lt;- data.table(X1=sample(1:7,4096000,replace=TRUE),
                             X2=as.factor(sample(1:2,4096000,replace=TRUE)),
                             X3=sample(1:1000,4096000,replace=TRUE),
                             X4=sample(1:256,4096000,replace=TRUE),
                             X5=sample(1:16,4096000,replace=TRUE),
                             X6=rnorm(4096000))
  
  setkey(tmp.table,X1,X2,X3,X4,X5,X6)
  
  join.table &lt;- data.table(X1 = integer(), X2 = factor(), 
                           X3 = integer(), X4=integer(),
                           X5 = integer(), X6 = numeric())
  
  setkey(join.table,X1,X2,X3,X4,X5,X6)
  
  tables()
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>     NAME            NROW  MB COLS              KEY              
  [1,] join.table         0   1 X1,X2,X3,X4,X5,X6 X1,X2,X3,X4,X5,X6
  [2,] tmp.table  4,096,000 110 X1,X2,X3,X4,X5,X6 X1,X2,X3,X4,X5,X6
  Total: 111MB
  </code></pre>
  
  <p>input:</p>
  
  <pre><code>join.table &lt;- merge(join.table,tmp.table,all.y=TRUE)
  </code></pre>
  
  <p>output:</p>
  
  <p>Ha! Nope. RStudio restarts the session.</p>
  
  <h3>question</h3>
  
  <p>What's going on here? Explicitly setting the factor levels in <code>join.table</code> had no effect. <code>rbind()</code> instead of <code>merge()</code> didn't help--exact same behavior. I have done way more complicated and bulky things related to this data without any problems.</p>
  
  <h3>version info</h3>
  
  <pre><code>$platform
  [1] "x86_64-pc-linux-gnu"
  
  $arch
  [1] "x86_64"
  
  $os
  [1] "linux-gnu"
  
  $system
  [1] "x86_64, linux-gnu"
  
  $version.string
  [1] "R version 3.0.2 (2013-09-25)"
  
  $nickname
  [1] "Frisbee Sailing"
  
  &gt; rstudio::versionInfo()
  $version
  [1] ‘99.9.9’
  
  $mode
  [1] "server"
  </code></pre>
  
  <p>Data.table is version 1.8.11.</p>