So far I have been using R on a 32-bit Windows XP machine resulting in 2 GB of available memory to R (using --max-mem-size=2047M). In a recent project involving permutation tests (using the coin package) this was not enough (i.e., cannot allocate vector of size ...).
Therefore, I would like to run R in an environment that gives me the most memory. I have a 4GB quadcore PC available for this endeavor (not my desktop PC, so I could play around with it a little and even use it via remote desktop).
Which operating system should I use to use the most memory? 64bit Windows (i.e. 7) or Linux? If Linux, which distribution?
So far, I haven’t used Linux at all so ease of use and installation would definitely be a plus. Furthermore, so far I have been using Notepadd++ and NPPtoR and it would be great if I could stay with this, too. However, most available memory is the primary target.
I’m going to talk about Windows in this answer. I know nothing substantial about other operating systems so I’ll not embarrass myself by not talking about them. I’m not making any judgements about which of Windows or Linux is better or worse than the other.
Nowadays, you always want to be using the 64 bit version of Windows rather than the 32 bit version. The 64 bit version of Windows runs 32 bit programs perfectly (sometimes even a little faster than the 32 bit version of Windows manages). When you run a 32 bit program under 64 bit Windows, it can get access to 4GB address space. Under 32 bit Windows it only gets a 2GB address space. So even if you stick to 32 bit R you’ll have more head-room under 64 bit Windows.
However, there is nowadays a 64 bit version of R. This is less mature than the 32 bit version but it will most likely meet your needs. You may need to check for package compatibility since some packages may not yet support 64 bit R on Windows yet.
You may actually experience a drop-off in performance with the 64 bit version of R because pointer width doubles and so the memory footprint is bigger. However, I’d be surprised if this was at all significant.
You can install both 32 and 64 bit versions side-by-side, but if you can get away with just one version I’d always recommend doing so – it makes maintenance so much easier.
As your machine only has 4GB of memory anyway, there’s probably not that much to be gained from using the 64 bit version of R. The 64 bit version of Windows will make a big difference, but if you go to the 64 bit version of R as well, and actually use 4GB of memory then you are likely to see lots of disk thrashing and your calculations will take forever.
Finally, when faced with memory resource shortages it is often possible to find alternative ways to organise your code so that you simply avoid the issue altogether. Since we don’t have the details of your R code, we can’t tell if that is the case here, but it may be worth thinking about.