Sum process memory from smaps

Show the total virtual memory size of a process from smaps, in MB.

cat /proc/<pid>/smaps | awk '/^Size/{sum+=$2} END{print sum/1024" MB"}'

tool
linux133 commands
tags
linuxmemorydebug

More linux commands

  • grep -E 'HugePages|AnonHugePages|Transparent' /proc/meminfo

    Check whether THP and hugepages are configured and in use.

  • echo never > /sys/kernel/mm/transparent_hugepage/enabled

    Turn off THP until the next reboot. It helps with latency spikes in Redis and MongoDB.

  • numactl --hardware

    Show NUMA nodes, which CPUs belong to each node and how memory is split.

  • sysctl -w net.core.somaxconn=65535 net.ipv4.tcp_max_syn_backlog=65535

    Increase the listen and SYN backlogs for services with many connections.

  • sysctl -w net.core.default_qdisc=fq net.ipv4.tcp_congestion_control=bbr

    Switch to Google's BBR congestion control for better throughput.

all 133 linux commands