3

I tried to check amount of free memory in cygwin, but it says that free is not found. Is it possible to do in cygwin, if so what package do I need to install?

$ free
-bash: free: command not found

2 Answers 2

5

The free command is part of the procps package.

2
$ cat /proc/meminfo 
...
MemFree:         1552148 kB
...
SwapFree:        8050832 kB

This command lists the contents of the special file /proc/meminfo, which reports the current distribution and utilization of memory, one line per item, including the free memory on the line beginning with "MemFree". This value matches the value reported by Windows(TM) task manager for free memory.

The /proc file system is part of Cygwin base package, intended to mimic its Linux version, described in kernel document proc.txt. Search for the word "meminfo" twice.

For the meaning of special files and their differences from Linux, see the Cygwin document using-specialnames.html. Look for the title "The /proc filesystem".

The line with SwapFree shows the amount of swap space remaining. If the physical memory is mostly free, the swap should also be free, at its initial maximum, typically equal to the physical memory size. A lower value shows the presence of a memory hog/leak, may lead to general slowdown of the system, growth of the swap file (pagefile.sys), consume disk space, and require terminating the memory hog and/or a system restart to return to normal.

2
  • 1
    Could you explain this a little bit? What is that command, how does it answer the question? May 24, 2017 at 22:36
  • 1
    That special file shows you the meminfo as text. free just formats it in a different way Feb 13, 2021 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .