Find out size of computer's memory?


#1

tldr: Is there a way to find out how much memory the computer has? There are environment variables for the processor properties, so something similar?

So why do I want to do this?
I’ve got a big file of data which I need to process sequentially. I have to do it in batches but want to minimize the number of reads from disk because that’s the bottleneck. So I want to read as much as fits, process that, repeat. But that requires me to know how much RAM is available.

Thanks for your help.


#2

Int(Sys.total_memory()), but some substantial fraction of that will likely be occupied by other processes. See also Int(Sys.free_memory()).