[R] allocMatrix limits

Martin Maechler maechler at stat.math.ethz.ch
Fri Aug 1 17:07:31 CEST 2008


>>>>> "VK" == Vadim Kutsyy <vadim at kutsyy.com>
>>>>>     on Fri, 01 Aug 2008 07:35:01 -0700 writes:

    VK> Martin Maechler wrote:
    >> 
    VK> The problem is in array.c, where allocMatrix check for
    VK> "if ((double)nrow * (double)ncol > INT_MAX)".  But why
    VK> itn is used and not long int for indexing? (max int is
    VK> 2147483647, max long int is 9223372036854775807)
    >> 
    >> Well, Brian gave you all info:
    >> 
    VK> exactly, and given that most modern system used for
    VK> computations (i.e.  64bit system) have long int which is
    VK> much larger than int, I am wondering why long int is not
    VK> used for indexing (I don't think that 4 bit vs 8 bit
    VK> storage is an issue).
    >> Did you really carefully read ?Memory-limits ??
    >> 
    VK> Yes, it is specify that 4 bit int is used for indexing
    VK> in all version of R, but why? I think 2147483647
    VK> elements for a single vector is OK, but not as total
    VK> number of elements for the matrix.  I am running out of
    VK> indexing at mere 10% memory consumption.

Hmm, do you have 160 GBytes of RAM?
But anyway, let's move this topic from R-help to R-devel.

   [...........]

    VK> PS: I have no problem to go and modify C code, but I am
    VK> just wondering what are the reasons for having such
    VK> limitation.

This limitation and its possible remedies are an interesting
topic, but really not for R-help:

It will be a lot about C programming the internal represenation
of R objects, etc.   
Very fascinating .... but for R-devel.  

"See you there!"
Martin



More information about the R-help mailing list