Skip to content
Back to formatted view

Raw Message

Message-ID: <Pine.LNX.4.44.0305151712340.1110-100000@gannet.stats>
Date: 2003-05-15T16:18:05Z
From: Brian Ripley
Subject: R as 64 bit application
In-Reply-To: <Pine.A41.4.44.0305150902550.23588-100000@homer36.u.washington.edu>

On Thu, 15 May 2003, Thomas Lumley wrote:

> On Thu, 15 May 2003, Paul Gilbert wrote:
> 
> > In a package test I have a problem that needs over 4G of memory. This
> > requires that I use R compiled as a 64 bit application. Is there a way
> > within R to test if R has been compile as a 64 bit application? This
> > would allow me to automatically skip the test when I know it is going to
> > fail.
> >
> 
> I don't think so.  You could use a simple C function
> 
> 
>   void is64bit (int *sizeptr){
> 	*sizeptr = sizeof sizeptr ==8;
> 	return;
> 	}
> 
> 
>   is64bit<-function(){
> 	.C("is64bit",logical(1))[[1]]
> 	}
> 

You could call object.size:

> object.size(numeric(0)) #32-bit
[1] 28
> object.size(numeric(0)) #64-bit
[1] 56

or you could look at the results of gc():

> foo <- gc()
> foo[1,4]/foo[1,3]*2^20
[1] 56.05374

and it's about 28 on a 32-bit system.


-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595