MEMHOG(8)
โจ NAME โจ
okay so bestie, memhog is literally the tool that allocates memory with a policy attached, and it's for testing ๐งช๐ It's giving stress test energy. memhog - Allocates memory with policy for testing.
๐ SYNOPSIS ๐
memhog [ -r<NUM> ] [ size kmg ] [ policy nodeset ] [ -f<filename> ]
๐ DESCRIPTION ๐
ngl this is the core of it. memhog mmaps a memory region for a given size and sets the numa policy (if you specify one) โจ Then it keeps updating that memory region for however many iterations you ask for, using memset. Iconic.
Here are the flags you can slap on:
-r<num>โ repeat thememsetNUM times ๐-f<file>โ open a file to use for mmap backing ๐-Hโ disable transparent hugepages, no thanks ๐ โโ๏ธ-sizeโ the allocation size in bytes. You can add a case-insensitive order suffix: G for gigabyte, M for megabyte, K for kilobyte ๐ธ
Now the numa policies, which are lowkey the best part ๐
Supported numa-policies:
interleaveโ memory gets allocated round robin across the nodes ๐ฆ If memory can't be allocated on the current interleave node, it falls back to other nodes. You can specify multiple nodes here.membindโ only allocate memory from these nodes. Allocation will fail if there isn't enough memory available on them, so no sneaking off to other nodes ๐ โโ๏ธ You can specify multiple nodes.preferredโ preferably allocate memory on the node you pick, but if it can't fit there, fall back to other nodes ๐ This one only takes a single node number, bestie.defaultโ memory gets allocated on the local node, meaning whichever node the thread is running on ๐ง
๐ EXAMPLES ๐
okay examples time, I'm obsessed with these ๐ญ
Allocate a 1G region, mmap backed by the memhog.mmap file, membind to node 0, and repeat the test 6 times:
memhog -r6 1G --membind 0 -fmemhog.mmap
Allocate a 1G region, interleave across nodes 0, 1, 2, and 3, and repeat the test 4 times:
memhog -r4 1G --interleave 0-3
Allocate a 1G region with the (implicit) default policy, and repeat the test 8 times:
memhog -r8 1G
๐ซถ AUTHORS ๐ซถ
Andi Kleen (ak@suse.de) โ the legend herself ๐
๐ฅ LICENSE ๐ฅ
GPL v2 ๐
๐ฆ SEE ALSO ๐ฆ
mmap(2), memset(3), numactl(8), numastat(8) โจ
okay bestie that's everything ๐ฅน memhog came from SuSE Labs, 2003,2004, and it's still giving ๐ Stay iconic, stay testing ๐๐ง
๐ฆ where this page comes from
- alpine 3.22: numactl-doc 2.0.18-r0 ยท LGPL-2.1-only
- alpine 3.23: numactl-doc 2.0.18-r0 ยท LGPL-2.1-only
- alpine 3.24: numactl-doc 2.0.19-r0 ยท LGPL-2.1-only
- arch rolling: numactl 2.0.19-1 ยท GPL-2.0-only AND LGPL-2.1-only
- centos-stream 10: numactl 2.0.19-3.el10 ยท GPL-2.0-only
- centos-stream 9: numactl 2.0.19-3.el9 ยท LGPL-2.1-only and GPL-2.0-only
- debian trixie: numactl 2.0.19-1
- fedora 43: numactl 2.0.19-3.fc43 ยท GPL-2.0-only
- fedora 44: numactl 2.0.19-4.fc44 ยท GPL-2.0-only
- nixpkgs unstable: numactl 2.0.18
- opensuse-leap 16.0: numactl 2.0.19.14.g690a72c-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: numactl 2.0.19.14.g690a72c-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: numactl 2.0.19.14.g690a72c-160000.2.2 ยท GPL-2.0-only
- opensuse-leap 16.0: numactl 2.0.19.14.g690a72c-160000.2.2 ยท GPL-2.0-only
- ubuntu noble: numactl 2.0.18-1build1
- ubuntu noble: numactl 2.0.18-1ubuntu0.24.04.1
- ubuntu questing: numactl 2.0.19-1
- ubuntu resolute: numactl 2.0.19-1build1
- ubuntu stonking: numactl 2.0.19-1build1
- ๐ girlified by anthropic/claude-haiku-5.5 on : a language model's rewrite of the original, under its terms