Why does an empty vector occupy 40 bytes?
Hi all, Why is the object size of an empty vector 40 bytes? (At least in 64-bit R.) object.size(integer(0)) # 40 bytes Reading R internals, it looks like it should be: * 4 bytes: sxpinfo header (= 32 bits) * 8 bytes: pointer to attributes * 8 bytes: pointer to next node * 8 bytes: pointer to previous node * 4 bytes: length * 4 bytes: true length = 36 bytes Where are the extra 4 bytes coming from? What have I missed? I thought it might be for memory alignment, but if it was padded by an additional 4 bytes, then an integer vector of length 1 should be the same size, assuming I've interpreted the comment about "aligned as required" correctly. Thanks! Hadley
Chief Scientist, RStudio http://had.co.nz/