Details on the utility `memhog` in Linux environment?

I'm working on reviewing memory usage on an EC2 instance running the Amazon kernel and ran across the utility /usr/bin/memhog but it has no manpage. Before blindly running, I was wondering what it does and how it use it.

Anyone use this and know what it does?


Solution 1:

I'd never heard of it before your mention of it. In an article on SCO Unix, My system is slow (Old Sco Unix) on the utility, though, it doesn't sound like it is apt for what you want to do.

Linux systems have "memhog" if numactl is installed. Numactl can assign specific a process to a specific cpu and control memory policy in other ways. The "memhog" does something very simple: it eats up memory and then releases it. Why would you ever do that?

Well, possibly to test how another app performs when starved for memory or to push unused memory in other apps out to swap (that can help you see what's really available should you need it).

Apparently, you provide an argument to the utility specifying how much memory you want it to take, e.g. memhog 512m - see Issue 19: crash with repeated cycles of memhog (x86 and x64)

Perhaps one of the utilities mentioned in 5 commands to check memory usage on Linux would be more suitable for your purpose.