Efficient memory management in R
R doesn't manage the memory of the machine. That is the responsibility of the operating system. The only reason memory.size
and memory.limit
exist on Windows is because (from help("Memory-limits")
):
Under Windows, R imposes limits on the total memory allocation
available to a single session as the OS provides no way to do so:
see 'memory.size' and 'memory.limit'.
R objects also have to occupy contiguous space in RAM, so you can run into memory allocation issues with only a few large objects. You could probably be more careful with the number/size of objects you create and avoid using so much memory.
Look at the ff and bigmemory packages. This uses functions that know about R objects to keep them on disk rather than letting the OS (which just knows about chunks of memory, but not what they represent).