{
  "schema_version": 2,
  "id": "commands/memory-stats",
  "title": "MEMORY STATS",
  "url": "https://redis.io/docs/latest/commands/memory-stats/",
  "summary": "Returns details about memory usage.",
  "since": "4.0.0",
  "tags": [
    "docs",
    "develop",
    "stack",
    "oss",
    "rs",
    "rc",
    "oss",
    "kubernetes",
    "clients"
  ],
  "last_updated": "2026-09-18T09:48:09+01:00",
  "page_type": "content",
  "content_hash": "268350d9b499e5886214499a7a005e84f9a7d4eac73e8c7634d806e0e93dea2d",
  "sections": [
    {
      "id": "overview",
      "title": "Overview",
      "role": "overview",
      "text": "The `MEMORY STATS` command returns an [Array reply](https://redis.io/docs/latest/develop/reference/protocol-spec#arrays) about the memory usage of the\nserver.\n\nThe information about memory usage is provided as metrics and their respective\nvalues. The following metrics are reported:\n\n*   `peak.allocated`: Peak memory consumed by Redis in bytes (see [`INFO`](https://redis.io/docs/latest/commands/info)'s\n     `used_memory_peak`)\n*   `total.allocated`: Total number of bytes allocated by Redis using its\n     allocator (see [`INFO`](https://redis.io/docs/latest/commands/info)'s `used_memory`)\n*   `startup.allocated`: Initial amount of memory consumed by Redis at startup\n     in bytes (see [`INFO`](https://redis.io/docs/latest/commands/info)'s `used_memory_startup`)\n*   `replication.backlog`: Size in bytes of the replication backlog (see\n     [`INFO`](https://redis.io/docs/latest/commands/info)'s `repl_backlog_active`)\n*   `clients.slaves`: The total size in bytes of all replicas overheads (output\n     and query buffers, connection contexts)\n*   `clients.normal`: The total size in bytes of all clients overheads (output\n     and query buffers, connection contexts)\n*   `cluster.links`: Memory usage by cluster links (Added in Redis 7.0, see [`INFO`](https://redis.io/docs/latest/commands/info)'s `mem_cluster_links`).\n*   `aof.buffer`: The summed size in bytes of AOF related buffers.\n*   `lua.caches`: the summed size in bytes of the overheads of the Lua scripts'\n     caches\n*   `functions.caches`: the summed size in bytes of the overheads of the Function scripts'\n     caches\n*   `hash.templates`: Total memory in bytes used by all compact hash templates (see [`INFO`](https://redis.io/docs/latest/commands/info)'s `used_memory_hash_templates`). Added in Redis 8.10.\n*   `dbXXX`: For each of the server's databases, the overheads of the main and\n     expiry dictionaries (`overhead.hashtable.main` and\n    `overhead.hashtable.expires`, respectively) are reported in bytes\n*   `overhead.db.hashtable.lut`: Total overhead of dictionary buckets in databases (Added in Redis 7.4)\n*   `overhead.db.hashtable.rehashing`: Temporary memory overhead of database dictionaries currently being rehashed (Added in Redis 7.4) \n*   `overhead.total`: The sum of all overheads, i.e. `startup.allocated`,\n     `replication.backlog`, `clients.slaves`, `clients.normal`, `aof.buffer` and\n     those of the internal data structures that are used in managing the\n     Redis keyspace (see [`INFO`](https://redis.io/docs/latest/commands/info)'s `used_memory_overhead`)\n*   `db.dict.rehashing.count`: Number of DB dictionaries currently being rehashed (Added in Redis 7.4)\n*   `keys.count`: The total number of keys stored across all databases in the\n     server\n*   `keys.bytes-per-key`: The ratio between `dataset.bytes` and `keys.count` \n*   `dataset.bytes`: The size in bytes of the dataset, i.e. `overhead.total`\n     subtracted from `total.allocated` (see [`INFO`](https://redis.io/docs/latest/commands/info)'s `used_memory_dataset`)\n*   `dataset.percentage`: The percentage of `dataset.bytes` out of the total\n     memory usage\n*   `peak.percentage`: The percentage of `total.allocated` out of\n     `peak.allocated`\n*   `allocator.allocated`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_allocated`\n*   `allocator.active`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_active`\n*   `allocator.resident`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_resident`\n*   `allocator.muzzy`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_muzzy`\n*   `allocator-fragmentation.ratio`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_frag_ratio`\n*   `allocator-fragmentation.bytes`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_frag_bytes`\n*   `allocator-rss.ratio`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_rss_ratio`\n*   `allocator-rss.bytes`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `allocator_rss_bytes`\n*   `rss-overhead.ratio`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `rss_overhead_ratio`\n*   `rss-overhead.bytes`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `rss_overhead_bytes`\n*   `fragmentation`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `mem_fragmentation_ratio`\n*   `fragmentation.bytes`: See [`INFO`](https://redis.io/docs/latest/commands/info)'s `mem_fragmentation_bytes`\n\n**A note about the word slave used in this man page**: Starting with Redis 5, if not for backward compatibility, the Redis project no longer uses the word slave. Unfortunately in this command the word slave is part of the protocol, so we'll be able to remove such occurrences only when this API will be naturally deprecated."
    },
    {
      "id": "redis-software-and-redis-cloud-compatibility",
      "title": "Redis Software and Redis Cloud compatibility",
      "role": "content",
      "text": "| Redis<br />Software | Redis<br />Cloud | <span style=\"min-width: 9em; display: table-cell\">Notes</span> |\n|:----------------------|:-----------------|:------|\n| <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> | <span title=\"Not supported\">&#x274c; Standard</span><br /><span title=\"Not supported\"><nobr>&#x274c; Active-Active</nobr></span> |  |"
    },
    {
      "id": "return-information",
      "title": "Return information",
      "role": "returns",
      "text": "**RESP2:**\n\n[Array reply](../../develop/reference/protocol-spec#arrays): a nested list of memory usage metrics and their values.\n\n**RESP3:**\n\n[Map reply](../../develop/reference/protocol-spec#maps): memory usage metrics and their values."
    }
  ],
  "examples": []
}
