[R] memory check

Thomas Lumley thomas at biostat.washington.edu
Wed Nov 22 18:38:46 CET 2000

On Wed, 22 Nov 2000, Michael Griswold wrote:

> I'm working on R1.1.1 and was wondering if there is a way to check how 
> much memory an object would require, a.k.a. a way to check whether the 
> object you'd like to create is going to exceed the heap memory 
> available?
>  Something to the effect of:
>   if ( memorycheck(object) > vsize ) { don't create object }
>   else { create object }

This isn't possible in full generality, though for matrices and dataframes
of atomic types it might be.

You can use try()
	if (inherits(object,"try-error"))
		didn't work
The disadvantage is that it might take a while to run out of memory


Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle

r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list