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

Uwe Ligges ligges at statistik.uni-dortmund.de
Tue Jan 4 17:27:06 CET 2005


roger bos wrote:

> 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)


memory.limit(4*1024-1)

should work (you get an overflow with 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.

Yes, but R does have the permission now to request 3.9 Gb, even if it 
does not get it from the OS.


> 
>>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?


If you don't trust the FAQ, you can try it out by assigning some big 
objects and look what happens..... if it crashes, you will see...


> 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?

I think you won't get that many memory from the OS, but R is now allowed 
to ask the OS in order to get it.


> 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?

I guess because of license issues. Is it permitted to distribute such a 
software (modified by Visual Studio) given both the Visual Studio 
license and the GPL from R???

Uwe Ligges


> Thanks in advance for any insight.
> 
> Roger J. Bos
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list