[R] Determining if swap memory is turned off

John C Frain frainj at gmail.com
Fri Jun 26 18:12:51 CEST 2009


On windows XP | start | Control Panel | System | Advanced |
Performance | Settings | Advanced | Virtual Memory | and select No
Pagefile.  I suspect Vista is similar.

John

2009/6/26 Prof. John C Nash <nashjc at uottawa.ca>:
> In order to run some performance tests on optimization tools, I want to be
> able
> to avoid the use of swap memory. In *nix systems, at least Linux ones, I can
> issue
> a 'sudo swapoff -a' command and use just the RAM available.  If I don't do
> this, at
> some point swap will be used, the disk goes ballistic and the machine is
> unresponsive
> because it is thrashing data to the swap.  I suspect others have encountered
> this
> too. Clearly I'd rather fail out than get into the thrashing situation.
> Generally I
> prefer no swap -- memory is cheap enough that it is easier not to worry
> about these
> sorts of woes. However, I'd like to make packages I'm developing
> bullet-proof.
>
> What I need to know is if there are similar facilities on other platforms
> and how to
> use them. I see memory.size and memory.limit for Windows -- making R less
> platform
> independent -- and they seem to work on a WinXP virtual machine I have
> available.
> However, I suspect that the memory.limit includes the swap. When I was
> running
> Windoze, I tried valiantly to get the PageFile.sys killed and found it kept
> being set
> up again despite following all the recommended steps. (I needed to avoid the
> plaintext of an encrypted file being "saved" for me!)  I know nothing about
> Mac
> swap and how to control it.
>
> Advice welcome.  Below is a crude but self-contained example.
>
> John Nash
>
> ## memcrash.R -- try to hit the wall with memory
>
> cat("memcrash.R -- try to hit the wall\n")
> cat("You should have swap turned off\n")
> temp<-readline("Do you?")
> if (temp != "y") stop("Fix swap")
>
> for (j in 1:10) {
>  n <- 5^j
>  cat("building matrix of order ",n,"\n")
>  A<-matrix(nrow=n, ncol=n)
> } # end loop
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
John C Frain
Economics Department
Trinity College Dublin
Dublin 2
Ireland
www.tcd.ie/Economics/staff/frainj/home.html
mailto:frainj at tcd.ie
mailto:frainj at gmail.com




More information about the R-help mailing list