{"id":1223,"date":"2026-09-25T23:07:47","date_gmt":"2026-09-25T23:07:47","guid":{"rendered":"https:\/\/virtualserversvps.com\/blog\/?p=1223"},"modified":"2026-09-25T23:07:47","modified_gmt":"2026-09-25T23:07:47","slug":"linux-memory-accounting-memavailable-vs-free-small-vps","status":"publish","type":"post","link":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/","title":{"rendered":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Every &#8220;is my VPS out of memory?&#8221; decision rests on two numbers from <code>\/proc\/meminfo<\/code>, and most operators read the wrong one. <code>MemFree<\/code> tells you how much RAM is completely unused &mdash; which on a healthy Linux host is always small, because the kernel spends spare memory on page cache. <code>MemAvailable<\/code> is the kernel&#8217;s own estimate of how much can be reclaimed under pressure without swapping. This article builds a repeatable budget: what the kernel costs, what your services cost in RSS and PSS, and how to prove the accounting adds up.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Why MemFree Is the Wrong Number<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>grep -E 'MemTotal|MemFree|MemAvailable|Cached|Buffers|SReclaimable|Shmem|Slab' \/proc\/meminfo\n\n# MemAvailable is already computed by the kernel at mm\/vmscan.c level.\n# Reproduce it intentionally to understand the formula:\nawk '\/MemFree\/{f=$2} \/Cached\/{c=$2} \/SReclaimable\/{s=$2}\n     \/Shmem\/{sh=$2} END{printf \"approx available: %.0f MB\\n\", (f + c + s - sh)\/1024}' \/proc\/meminfo<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">On a 1 GB VPS, <code>MemFree<\/code> of 60 MB with <code>Cached<\/code> of 500 MB is a <em>well-utilised<\/em> host, not a struggling one. Alert on <code>MemAvailable \/ MemTotal &lt; 15%<\/code> sustained, combined with swap-in activity from <code>vmstat<\/code>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># the only line that matters for memory pressure\nvmstat 5 12   # columns: si (swap in) so (swap out)\n\n# per-cgroup pressure stall information \u2014 best early-warning signal\ncat \/sys\/fs\/cgroup\/system.slice\/memory.pressure\n# some avg10=0.00 avg60=0.05 avg300=0.10 total=182340\n# full avg10=0.00 avg60=0.02 avg300=0.05 total=91211<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Building the Overhead Budget<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">RSS double-counts shared pages. PSS divides each shared page by the number of mappers, which is the only honest way to attribute memory to services. Use PSS for budgeting:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># per-process PSS, memory in KB, largest first\nsudo smem -tk --sort=pss | head -20\n\n# or without smem, from \/proc directly\nfor p in $(ls \/proc | grep -E '^[0-9]+$'); do\n  pss=$(awk '\/^Pss:\/{s+=$2} END{print s+0}' \/proc\/$p\/smaps_rollup 2&gt;\/dev\/null)\n  [ -n \"$pss\" ] &amp;&amp; [ \"$pss\" -gt 0 ] &amp;&amp; \\\n    printf \"%8d KB  %s\\n\" \"$pss\" \"$(tr -d '\\0' \/dev\/null)\"\ndone | sort -rn | head -20<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Now account for the parts that never show up under a process name:<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Item<\/th><th>Typical cost on a 1 GB VPS<\/th><th>Where to see it<\/th><\/tr><\/thead><tbody><tr><td>Kernel slab<\/td><td>80&ndash;200 MB<\/td><td><code>Slab<\/code> in <code>\/proc\/meminfo<\/code>, <code>slabtop<\/code><\/td><\/tr><tr><td>Page tables<\/td><td>20&ndash;60 MB<\/td><td><code>PageTables<\/code><\/td><\/tr><tr><td>Kernel stack + task structs<\/td><td>~16 KB &times; threads<\/td><td><code>KernelStack<\/code>, thread count<\/td><\/tr><tr><td>tmpfs \/ <code>\/dev\/shm<\/code><\/td><td>Often unbounded<\/td><td><code>Shmem<\/code>, <code>df -h \/dev\/shm<\/code><\/td><\/tr><tr><td>Socket \/ conntrack buffers<\/td><td>5&ndash;40 MB at high connection counts<\/td><td><code>tcp_mem<\/code>, <code>nf_conntrack<\/code><\/td><\/tr><tr><td>Hugepages<\/td><td>2 MB per reserved page<\/td><td><code>HugePages_Total<\/code><\/td><\/tr><tr><td>Fragmentation reserve<\/td><td>~5% unusable in practice<\/td><td>indirect<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># find the slab hogs\nsudo slabtop -o -s c | head -15\n\n# page table cost scales with mapped memory, not with process count alone\ngrep -E 'PageTables|KernelStack|Shmem|Slab|SUnreclaim' \/proc\/meminfo\n\n# thread count is a memory cost multiplier\nps -eLf | wc -l\n\n# tmpfs can silently eat gigabytes\ndf -h | grep -E 'tmpfs|shm'<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Practical Budget on a 1 GB VPS<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Starting from 1024 MB of <code>MemTotal<\/code>, a realistic allocation that avoids OOM without wasting RAM:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>MemTotal           1024 MB\nkernel + slab       160 MB   (fixed tax)\npage tables          30 MB\nnginx (PSS)          45 MB\nphp-fpm 4 workers   180 MB   (4 x 45 MB PSS, shared opcache counted once)\nMariaDB            280 MB   (innodb_buffer_pool 128M + per-thread overhead)\nredis               25 MB\nsystemd\/journald    40 MB\nsshd + cron + misc  35 MB\n-----------------------------\nallocated          795 MB\nheadroom           229 MB   (page cache + burst, target &gt;=15%)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If your accounting shows less than 15% headroom, either reduce a line item or accept swap as a safety net rather than a strategy. A methodical reduction of the largest consumers &mdash; buffer pools and worker counts &mdash; is covered in depth in <a href=\"https:\/\/virtualserversvps.com\/\">the memory-focused tuning guides on virtualserversvps.com<\/a>. For workloads that genuinely need more than 1 GB, re-examine whether a larger plan is cheaper than engineering around a hard ceiling: <a href=\"https:\/\/virtualserversvps.com\/\">the plan comparison on virtualserversvps.com<\/a> lays out the break-even point.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Verify the Accounting Adds Up<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code># 1. sum PSS across all processes\ntotal_pss=$(for p in \/proc\/[0-9]*; do\n  awk '\/^Pss:\/{s+=$2} END{print s+0}' \"$p\/smaps_rollup\" 2&gt;\/dev\/null; done \\\n  | paste -sd+ | bc)\necho \"total PSS: $((total_pss\/1024)) MB\"\n\n# 2. kernel-side consumption\nawk '\/MemTotal\/{t=$2} \/MemFree\/{f=$2} \/Cached\/{c=$2} \/Slab\/{s=$2}\n     END{printf \"used-non-cache: %.0f MB\\n\", (t-f-c)\/1024}' \/proc\/meminfo\n\n# 3. the two should reconcile within ~5%; a large gap means kernel\n#    allocations you are not accounting for (usually slab fragmentation)\nsudo slabtop -o -s c | head -5<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Guardrails<\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>Alert on <code>MemAvailable<\/code>, never on <code>MemFree<\/code>.<\/li><li>Budget services by PSS from <code>smaps_rollup<\/code>, and treat the thread count as a multiplier.<\/li><li>Audit <code>Shmem<\/code> and <code>tmpfs<\/code> monthly; they grow silently.<\/li><li>Set explicit cgroup <code>memory.high<\/code> on each service so one component cannot trigger a host-wide OOM kill.<\/li><li>Validate with a reconciliation script and store the output &mdash; a budget you never check is a guess.<\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Memory planning on a small VPS is arithmetic, not intuition. Once <code>MemAvailable<\/code> and PSS-based accounting are both in place, &#8220;why did my server get OOM-killed&#8221; becomes a solved query rather than a mystery.<\/p>\n\n","protected":false},"excerpt":{"rendered":"<p>Every &#8220;is my VPS out of memory?&#8221; decision rests on two numbers from \/proc\/meminfo, and most operators read the wrong one. MemFree tells you how much RAM is completely unused&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"iawp_total_views":0,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-1223","post","type-post","status-publish","format-standard","hentry","category-performance-optimization"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.1 (Yoast SEO v26.1) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot - Virtual Servers VPS Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot\" \/>\n<meta property=\"og:description\" content=\"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot\" \/>\n<meta property=\"og:url\" content=\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/\" \/>\n<meta property=\"og:site_name\" content=\"Virtual Servers VPS Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-25T23:07:47+00:00\" \/>\n<meta name=\"author\" content=\"Virtual-Servers-Vps-Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Virtual-Servers-Vps-Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/\",\"name\":\"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot - Virtual Servers VPS Blog\",\"isPartOf\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\"},\"datePublished\":\"2026-09-25T23:07:47+00:00\",\"author\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\"},\"breadcrumb\":{\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/virtualserversvps.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#website\",\"url\":\"https:\/\/virtualserversvps.com\/blog\/\",\"name\":\"Virtual Servers VPS Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0\",\"name\":\"Virtual-Servers-Vps-Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g\",\"caption\":\"Virtual-Servers-Vps-Editor\"},\"sameAs\":[\"https:\/\/virtualserversvps.com\/blog\"],\"url\":\"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot - Virtual Servers VPS Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/","og_locale":"en_US","og_type":"article","og_title":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot","og_description":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot","og_url":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/","og_site_name":"Virtual Servers VPS Blog","article_published_time":"2026-09-25T23:07:47+00:00","author":"Virtual-Servers-Vps-Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Virtual-Servers-Vps-Editor","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/","url":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/","name":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot - Virtual Servers VPS Blog","isPartOf":{"@id":"https:\/\/virtualserversvps.com\/blog\/#website"},"datePublished":"2026-09-25T23:07:47+00:00","author":{"@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0"},"breadcrumb":{"@id":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/virtualserversvps.com\/blog\/linux-memory-accounting-memavailable-vs-free-small-vps\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/virtualserversvps.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Linux Memory Accounting for Small VPS Hosts: MemAvailable vs Free, and Every Bit of Overhead You Forgot"}]},{"@type":"WebSite","@id":"https:\/\/virtualserversvps.com\/blog\/#website","url":"https:\/\/virtualserversvps.com\/blog\/","name":"Virtual Servers VPS Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/virtualserversvps.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/82a299a8284a66ff49f97c74684724a0","name":"Virtual-Servers-Vps-Editor","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/virtualserversvps.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d820b15f1cd028e97610d9adf536df7be5cb6423869967037d468d5355fa003f?s=96&d=mm&r=g","caption":"Virtual-Servers-Vps-Editor"},"sameAs":["https:\/\/virtualserversvps.com\/blog"],"url":"https:\/\/virtualserversvps.com\/blog\/author\/virtualserversvps\/"}]}},"_links":{"self":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1223","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/comments?post=1223"}],"version-history":[{"count":1,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1223\/revisions"}],"predecessor-version":[{"id":1225,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/posts\/1223\/revisions\/1225"}],"wp:attachment":[{"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/media?parent=1223"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/categories?post=1223"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualserversvps.com\/blog\/wp-json\/wp\/v2\/tags?post=1223"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}