<div dir="ltr"><div>Hi, </div><div><br class="">I had a memory bug when I tried to run the following script that wants to select a subset rows of data.table, the bug is somehow fixed by making a copy of the input data.table however:<br></div><div><br></div><div><div>library(data.table)</div><div><br></div><div>load('test_bug.RData')</div><div><br></div><div>Test.Bug <- function(tmp_move, ID){ </div><div> print(ID)</div><div> #tmp_move <- copy(tmp_move)</div><div> coverage <- tmp_move[, .(c.count= sum(dummy== 0)), by= group]</div><div> groups_selected <- unique(coverage[c.count>120, group])</div><div> tmp_move2 <- tmp_move[group %in% groups_selected]</div><div> return(tmp_move2)</div><div>}</div><div><br></div><div>move[, Test.Bug(.SD, ID), by= ID]</div></div><div><br></div><div><br></div><div> *** caught segfault ***</div><div>address 0x7fc3910d2824, cause 'memory not mapped'</div><div><br></div><div>Traceback:</div><div> 1: bmerge(i, x, leftcols, rightcols, io <- FALSE, xo, roll = 0, rollends = c(FALSE, FALSE), nomatch = 0L, verbose = verbose)</div><div> 2: `[.data.table`(tmp_move, group %in% groups_selected)</div><div> 3: tmp_move[group %in% groups_selected]</div><div> 4: Test.Bug(.SD, ID)</div><div> 5: `[.data.table`(move, , Test.Bug(.SD, ID), by = ID)</div><div> 6: move[, Test.Bug(.SD, ID), by = ID]</div><div><br></div><div><br></div>-- <br><div class="gmail_signature"><div>
<div dir="ltr">Zhida(George) Gui
<div>Mathematics and Economics Major </div>
<div><a href="mailto:Email%3Aguizhida@gmail.com" target="_blank">Email:guizhida@gmail.com</a><br>Cell:773-614-2597</div></div></div></div>
</div>