[R] How to verify using more than 2GB of memory

roger bos roger.bos at gmail.com
Tue Jan 4 16:39:37 CET 2005


My machine has 4Gb of memory under WinXP Pro.  Re-reading R for
Windows FAQ 2.7 I discovered that I can use editbin to add the
"/LARGEADDRESSAWARE" tag in the header without re-compiling, so that
is what I did.  I also check that it worked using dumpbin.  I then
edited my Boot.ini file to add the /3GB switch.  Then I went to my
R.0.0.1 patched that I modified as above and checked memory limit:

> memory.limit(NA)
[1] 1073741824

This is usual default.

> memory.limit(3*1024)
NULL
> memory.limit(4*1024)
Error in memory.size(size) : cannot decrease memory limit

It seems to work, since I am able to allocate 3Gb of memory, but not
4Gb  (though the error message I get isn't very helpful since I am
clearly not trying to decrease the memory limit).

However, this does not seem a good way to check that my
LARGEADDRESSAWARE version of R is working properly, because when I do
the same memory.limit operations on 2.0.1.0 dev that I downloaded this
morning I get the same results, without having made the program
LARGEADDRESSAWARE

Also, although trying to allocate 4Gb of memory does produce an error,
I can allocate 3.9Gb, which seems hard to beleive because the OS is
supposed to reserve 1Gb.

> memory.limit(3.9*1024)
NULL
> memory.limit(NA)
[1] 4187593113
> 

So, finally, here are my questions, in order of interest:
1)  Once I have made my version of R LARGEADDRESSAWARE, how do I best
verify that all is well?
2)  Why was I able to increase the memory.limit to 3.9Gb on the new
version of R.0.1.0 that I did not make LARGEADDRESSAWARE?
3)  Is there any side-effect to making a program LARGEADDRESSAWARE?  I
don't want to sound lazy, but for the benefit of those who don't have
Visual Studio, why not make the distributed binary LARGEADDRESSAWARE?

Thanks in advance for any insight.

Roger J. Bos




More information about the R-help mailing list