Search code examples
rvectorstack-overflowcoercion

Bug in coercion of large vectors?


I just installed R version 3.5.0 and according to this article on Revolution Analytics there is a new internal representation of vectors.

When I do the following I either get no result at all (see the following example) or the whole computer freezes for good:

> x <- 1:1e9
> c(x, "a")
>

So it seems that there is some routine missing which catches an overflow error in such cases (or at least gives a warning).

My question
Is this a reproducible bug?


Solution

  • The same sequence of statements causes R to (apparently) hang in 3.4.x as well. You are creating a character object that requires at least 8Gb of RAM, which may take a while if it completes at all.

    On R 3.4.3 I get the message "Error: cannot allocate a vector of size 7.5Gb", which I expect. On R 3.5.0 the message is "cannot allocate a vector of size 128.0Mb". The size is incorrect: R 3.5.0 is still trying to create an 8Gb object here. But the wait and ultimate failure is not surprising.

    Your statement does work as expected for smaller object sizes.