Linux ate my RAM (2009)
There&#x27;s some really interesting little details here.<p>Linux, by default, is making the very reasonable assumption that the marginal cost of converting empty physical memory into caches and buffers is very near zero. This is fundamentally reasonable, because the cost of converting empty memory into used memory isn&#x27;t really any cheaper than converting a clean cached page into used memory. It&#x27;s a little more subtle when you take accounting into account, or when you think about dirty pages (which need to be written back to clear memory), or think about caches, but the core assumption is a very reasonable one.<p>Except for on some multi-tenant infrastructure. Here, &quot;empty&quot; pages don&#x27;t really exist. There&#x27;s mostly not an empty page of memory kicking around waiting (like there is on client devices). Instead, nearly all the memory on the box is allocated, but each individual guest kernel doesn&#x27;t know the full allocation. In this world, the assumption that the marginal cost of converting empty to full is zero is no longer true. There&#x27;s some real cost.<p>Projects like DAMON <a href="https:&#x2F;&#x2F;sjp38.github.io&#x2F;post&#x2F;damon&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;sjp38.github.io&#x2F;post&#x2F;damon&#x2F;</a> exist to handle this case, and similar cases where keeping empty memory rather than low-value cache is worse for the overall system. These kinds of systems aren&#x27;t super common, especially on the client side, but aren&#x27;t unusual in large-scale cloud services.