[Rd] negative numbers from object.size() on 64 bit systems

Roger D. Peng rpeng at jhsph.edu
Wed Dec 17 23:57:26 MET 2003


Okay, just recompiled the version out of CVS.  Things seem fine now. 
This is what I get on the Opteron:

 > object.size(numeric(0))
[1] 56
 > b <- numeric(131072 * 2800)
 > object.size(b)
[1] 2936012856
 > object.size(b)/2^20
[1] 2800
 >

-roger

Prof Brian Ripley wrote:
> On Wed, 17 Dec 2003, Roger D. Peng wrote:
> 
> 
>>Has anyone running R 1.8.1 on a 64 bit system gotten negative numbers 
>>from object.size() on objects > 2GB or so?  For example, on 
>>Solaris/Sparc I get
>>
>> > b <- numeric(131072 * 2800)
>> > object.size(b)
>>[1] -1358954440
>>
>>I get similar behavior on the Opteron (SuSE Linux).  I'm not sure if 
>>this is an R problem or something wrong with the way it was compiled on 
>>either system.
>>
>>I noticed in objectsize() in size.c, the `cnt' variable is an int, which 
>>I guess would max out at 2^31.  Might this be the problem?  Any hints 
>>would be appreciated.
> 
> 
> Yes, and so is objectsize, and the return type is integer.  At the time
> that was written R could not use more than 2Gb.
> 
> I've modified the function but have no machine with more than 2Gb to test 
> it on, so could you please try R-devel in a couple of days?
>



More information about the R-devel mailing list