R - Same memory usage of matrix with different size
I was interested with the memory usage of matrix in R when I observed
something strange. In a loop, I have made grow up the number of columns of
a matrix and calculated, for each step, the object size.
x=10
size=matrix(1:x,x,2)
for (i in c(1:x)){
m = matrix(1,2, i)
size[i,2]=object.size(m)
}
Plotted my result
plot(size[,1],size[,2])
It seems that a matrix with 2 rows and 5,6,7 or 8 columns uses the same
memory. How can we explain that?
No comments:
Post a Comment