MEMORY

Since 1.1.0ServerChanged in 1.2.1

Syntax

MEMORY
  • Flags: readonly
  • ACL categories: @slow
  • Arity: -2

History

  • 1.2.1: acl categories: removed server

MEMORY is a container: its subcommands report on the server's memory and on what a key takes.

Subcommand
MEMORY USAGEthe bytes a key and its value take
MEMORY STATSthe server's memory figures, as name-value pairs
MEMORY DOCTORa sentence on anything that looks wrong
MEMORY PURGEask the allocator to give free memory back
MEMORY MALLOC-STATSthe allocator's own report, which KiviDB does not have
MEMORY HELPthe list, from the server

Memory explains what a key takes, how memory is counted, and what deleting gives back. MEMORY alone is an error.

Examples

> MEMORY
(error) ERR wrong number of arguments for 'memory' command
> HSET user:1 name Alice
(integer) 1
> MEMORY USAGE user:1
(integer) 193

Subcommands

  • MEMORY DOCTOR: Returns a short report on memory health, in Redis's words.
  • MEMORY HELP: Lists the MEMORY subcommands, one line each with its arguments, followed by an indented line saying what it does: DOCTOR, MALLOC-STATS, PURGE, STATS, USAGE and HELP.
  • MEMORY MALLOC-STATS: Returns the memory allocator's statistics, in Redis.
  • MEMORY PURGE: Asks the allocator to give the free memory it holds back to the system.
  • MEMORY STATS: Returns the server's memory figures as name-value pairs, with the same names as Redis, for tools that read them:
  • MEMORY USAGE: Returns an estimate of the bytes key and its value take; nil if the key does not exist.