MEMHOG(8)               Linux Administrator's Manual               MEMHOG(8)

NAME         top

       memhog - Allocates memory with policy for testing

SYNOPSIS         top

       memhog [ -r<NUM> ] [ size kmg ] [ policy nodeset ] [ -f<filename> ]

DESCRIPTION         top

       memhog mmaps a memory region for a given size and sets the numa
       policy (if specified).  It then updates the memory region for the
       given number of iterations using memset.

       -r<num>    Repeat memset NUM times
       -f<file>   Open file for mmap backing
       -H         Disable transparent hugepages
       -size      Allocation size in bytes, may have case-insensitive order
                  suffix (G=gigabyte, M=megabyte, K=kilobyte)

       Supported numa-policies:

              Memory will be allocated using round robin on nodes. When
              memory cannot be allocated on the current interleave, target
              fall back to other nodes.  Multiple nodes may be specified.

              Only  allocate  memory  from  nodes. Allocation will fail when
              there is not enough memory available on these nodes. Multiple
              nodes  may be specified.

              Preferably allocate memory on node, but if memory cannot be
              allocated  there  fall  back  to other nodes.  This option
              takes only a single node number.

              Memory will be allocated on the local node (the node the
              thread is running on)

EXAMPLES         top

       # Allocate a 1G region, mmap backed by memhog.mmap file, membind to
       node 0, repeat test 6 times
              memhog -r6 1G --membind 0 -fmemhog.mmap

       # Allocate a 1G region, iterleave across nodes 0,1,2,3, repeat test 4
              memhog -r4 1G --interleave 0-3

       # Allocate a 1G region, (implicit) default policy, repeat test 8
              memhog -r8 1G

AUTHORS         top

       Andi Kleen (

LICENSE         top

       GPL v2

SEE ALSO         top

       mmap(2), memset(3), numactl(8), numastat(8)

COLOPHON         top

       This page is part of the numactl (NUMA commands) project.
       Information about the project can be found at 
       ⟨⟩.  If you have a bug report for
       this manual page, send it to  This page
       was obtained from the project's upstream Git repository
       ⟨⟩ on 2020-02-08.  (At that
       time, the date of the most recent commit that was found in the repos‐
       itory was 2020-01-08.)  If you discover any rendering problems in
       this HTML version of the page, or you believe there is a better or
       more up-to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not part
       of the original manual page), send a mail to

SuSE Labs                         2003,2004                        MEMHOG(8)