[R] how much memory? was: R does in memory analysis only?

Douglas Bates bates at stat.wisc.edu
Wed Feb 11 22:38:46 CET 2004


"Samuelson, Frank*" <FWS4 at CDRH.FDA.GOV> writes:

> Is there a way to tell how much memory the computer
> running R has?

Most Linux distributions have a program called 'free' that reports on
the total amount of memory available and the amount used for different
purposes.  From within R you could use

> system("free")
             total       used       free     shared    buffers     cached
Mem:       1552072    1462044      90028          0     176892     922176
-/+ buffers/cache:     362976    1189096
Swap:      1951888      12360    1939528

which shows that the total amount of memory on this machine is 1.5 GB,
of which about 1.2 GB is available if needed.

Another method in Linux (depending on your kernel) is

> system("cat /proc/meminfo")
        total:    used:    free:  shared: buffers:  cached:
Mem:  1589321728 1497116672 92205056        0 181149696 945790976
Swap: 1998733312 12656640 1986076672
MemTotal:      1552072 kB
MemFree:         90044 kB
MemShared:           0 kB
Buffers:        176904 kB
Cached:         922172 kB
SwapCached:       1452 kB
Active:         664200 kB
Inactive:       543492 kB
HighTotal:      655344 kB
HighFree:        10372 kB
LowTotal:       896728 kB
LowFree:         79672 kB
SwapTotal:     1951888 kB
SwapFree:      1939528 kB




More information about the R-help mailing list