Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updata.table issues with reference counting #4093
Comments
|
Sadly, although good progress was made on #3301, it wasn't finished (assign.c was known and on the list not yet ticked). Otherwise that would have caught this. When this is complete then, #3301 should be finished and that should catch any remaining via no longer using DATAPTR and not using USE_RINTERNALS. |
Hi Matt,
I spent an entire day tracking down an issue that turns out to be a
problem in the data.table internals. Here is a simple reproducible
example:
After deletion of two leading columns the remaining column has
reference count zero. The reason is that in assign.c you use memmove
on the DATAPTR to shift remaining columns, which does not adjust
reference counts, and then use SET_VECTOR_ELT to replace a shifted
column by R_NilValue, which decrements the reference count the moved
column. You need to re-think this to work with reference counting.
Only modifying vector content with SET_VECTOR ELT is the safe and only
supported approach. You may need to make similar adjustments in other
places.
Best,
Luke