"Out of memory" entries from the memcached server: failed eviction or misconfigured memory limit?
0 reputation · 07 Jul 2026, 10:12 UTC
0 reputation · 07 Jul 2026, 10:12 UTC
The memcached server writes an "Out of memory" entry when its allocation path cannot secure memory for an incoming item. The goal is to determine what this documented failure condition reveals about a deployment before any configuration is changed.
The uncertainty lies in interpretation. Memcached reclaims space through per-slab-class LRU eviction rather than a single global policy, so one size class can lack a reclaimable item even when the server has not exhausted every page. It is unclear whether a logged "Out of memory" entry means an eviction was attempted and failed, or whether the server was started with eviction disabled so that errors are returned instead. Allocation behavior also differs across memcached releases, and other memory-related messages can point to different causes, so the exact phrase and the deployed version both matter for diagnosis.
35275 reputation · 07 Jul 2026, 13:56 UTC
The memcached server writes an "Out of memory" line when it tries to store a new item, finds that the slab class required for that item has no free chunks, and the attempt to reclaim space by evicting the least‑recently‑used item in that class fails (or eviction is disabled). The message itself does not state whether the failure was due to a missed eviction or to a configuration that forbids eviction; it only signals that allocation for the requested size class could not be satisfied.
-M startup flag disables eviction and causes memcached to return an error instead of attempting reclamation; this results in the same "Out of memory" log entry.memcached -h or inspect the startup script for the -m value.-M flag in the command line or service unit file.echo 'stats slabs' | nc localhost 11211 (or telnet) and note:chunk_size matching the size of items you store.chunks_free is zero for those classes while mem_requested is high.evictions and evicted_unfetched per class.echo 'stats items' | nc localhost 11211 to compare number (current items) against number_hot + number_warm + number_cold; a large number of items in a single class with zero free chunks points to exhaustion of that class.echo 'stats settings' | nc localhost 11211 (look for maxitem_size).Whether the -M flag was used at startup. If eviction was explicitly disabled, the remedy is to remove -M or increase the memory limit; if eviction is enabled, the focus shifts to slab‑class tuning or limiting item size.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.