1. 06 Dec, 2020 1 commit
  2. 02 Oct, 2020 1 commit
  3. 02 Dec, 2019 1 commit
  4. 15 Sep, 2019 1 commit
  5. 02 Jun, 2019 1 commit
    • Oran Agra's avatar
      make redis purge jemalloc after flush, and enable background purging thread · 09f99c2a
      Oran Agra authored
      jemalloc 5 doesn't immediately release memory back to the OS, instead there's a decaying
      mechanism, which doesn't work when there's no traffic (no allocations).
      this is most evident if there's no traffic after flushdb, the RSS will remain high.
      
      1) enable jemalloc background purging
      2) explicitly purge in flushdb
      09f99c2a
  6. 30 Sep, 2018 1 commit
    • Bruce Merry's avatar
      Fix incorrect memory usage accounting in zrealloc · 8fd1031b
      Bruce Merry authored
      When HAVE_MALLOC_SIZE is false, each call to zrealloc causes used_memory
      to increase by PREFIX_SIZE more than it should, due to mis-matched
      accounting between the original zmalloc (which includes PREFIX size in
      its increment) and zrealloc (which misses it from its decrement).
      
      I've also supplied a command-line test to easily demonstrate the
      problem. It's not wired into the test framework, because I don't know
      TCL so I'm not sure how to automate it.
      8fd1031b
  7. 16 Jul, 2018 1 commit
    • Oran Agra's avatar
      slave buffers were wasteful and incorrectly counted causing eviction · bf680b6f
      Oran Agra authored
      A) slave buffers didn't count internal fragmentation and sds unused space,
         this caused them to induce eviction although we didn't mean for it.
      
      B) slave buffers were consuming about twice the memory of what they actually needed.
      - this was mainly due to sdsMakeRoomFor growing to twice as much as needed each time
        but networking.c not storing more than 16k (partially fixed recently in 237a38737).
      - besides it wasn't able to store half of the new string into one buffer and the
        other half into the next (so the above mentioned fix helped mainly for small items).
      - lastly, the sds buffers had up to 30% internal fragmentation that was wasted,
        consumed but not used.
      
      C) inefficient performance due to starting from a small string and reallocing many times.
      
      what i changed:
      - creating dedicated buffers for reply list, counting their size with zmalloc_size
      - when creating a new reply node from, preallocate it to at least 16k.
      - when appending a new reply to the buffer, first fill all the unused space of the
        previous node before starting a new one.
      
      other changes:
      - expose mem_not_counted_for_evict info field for the benefit of the test suite
      - add a test to make sure slave buffers are counted correctly and that they don't cause eviction
      bf680b6f
  8. 19 Jun, 2018 1 commit
    • Oran Agra's avatar
      add malloc_usable_size for libc malloc · 482785ac
      Oran Agra authored
      this reduces the extra 8 bytes we save before each pointer.
      but more importantly maybe, it makes the valgrind runs to be more similiar
      to our normal runs.
      
      note: the change in malloc_stats struct in server.h is to eliminate an name conflict.
      structs that are not typedefed are resolved from a separate name space.
      482785ac
  9. 12 Mar, 2018 1 commit
    • Oran Agra's avatar
      Adding real allocator fragmentation to INFO and MEMORY command + active defrag test · 806736cd
      Oran Agra authored
      other fixes / improvements:
      - LUA script memory isn't taken from zmalloc (taken from libc malloc)
        so it can cause high fragmentation ratio to be displayed (which is false)
      - there was a problem with "fragmentation" info being calculated from
        RSS and used_memory sampled at different times (now sampling them together)
      
      other details:
      - adding a few more allocator info fields to INFO and MEMORY commands
      - improve defrag test to measure defrag latency of big keys
      - increasing the accuracy of the defrag test (by looking at real grag info)
        this way we can use an even lower threshold and still avoid false positives
      - keep the old (total) "fragmentation" field unchanged, but add new ones for spcific things
      - add these the MEMORY DOCTOR command
      - deduct LUA memory from the rss in case of non jemalloc allocator (one for which we don't "allocator active/used")
      - reduce sampling rate of the rss and allocator info
      806736cd
  10. 09 May, 2017 1 commit
  11. 10 Jan, 2017 1 commit
  12. 30 Dec, 2016 1 commit
  13. 19 Sep, 2016 1 commit
  14. 17 Dec, 2014 1 commit
  15. 12 Nov, 2014 1 commit
  16. 24 Mar, 2014 1 commit
    • antirez's avatar
      Sample and cache RSS in serverCron(). · 93253c27
      antirez authored
      Obtaining the RSS (Resident Set Size) info is slow in Linux and OSX.
      This slowed down the generation of the INFO 'memory' section.
      
      Since the RSS does not require to be a real-time measurement, we
      now sample it with server.hz frequency (10 times per second by default)
      and use this value both to show the INFO rss field and to compute the
      fragmentation ratio.
      
      Practically this does not make any difference for memory profiling of
      Redis but speeds up the INFO call significantly.
      93253c27
  17. 19 Nov, 2012 1 commit
  18. 24 Aug, 2012 1 commit
    • antirez's avatar
      Better Out of Memory handling. · 6fdc6354
      antirez authored
      The previous implementation of zmalloc.c was not able to handle out of
      memory in an application-specific way. It just logged an error on
      standard error, and aborted.
      
      The result was that in the case of an actual out of memory in Redis
      where malloc returned NULL (In Linux this actually happens under
      specific overcommit policy settings and/or with no or little swap
      configured) the error was not properly logged in the Redis log.
      
      This commit fixes this problem, fixing issue #509.
      Now the out of memory is properly reported in the Redis log and a stack
      trace is generated.
      
      The approach used is to provide a configurable out of memory handler
      to zmalloc (otherwise the default one logging the event on the
      standard output is used).
      6fdc6354
  19. 16 May, 2012 1 commit
  20. 05 Apr, 2012 1 commit
  21. 27 Mar, 2012 1 commit
  22. 07 Feb, 2012 1 commit
  23. 02 Jul, 2011 1 commit
  24. 20 Jun, 2011 1 commit
  25. 09 Jan, 2011 1 commit
  26. 02 Nov, 2010 1 commit
  27. 02 Sep, 2010 1 commit
  28. 24 Jul, 2010 1 commit
    • Benjamin Kramer's avatar
      Add zcalloc and use it where appropriate · 399f2f40
      Benjamin Kramer authored
      calloc is more effecient than malloc+memset when the system uses mmap to
      allocate memory. mmap always returns zeroed memory so the memset can be
      avoided.  The threshold to use mmap is 16k in osx libc and 128k in bsd
      libc and glibc. The kernel can lazily allocate the pages, this reduces
      memory usage when we have a page table or hash table that is mostly
      empty.
      
      This change is most visible when you start a new redis instance with vm
      enabled.  You'll see no increased memory usage no matter how big your
      page table is.
      399f2f40
  29. 01 Jul, 2010 1 commit
    • antirez's avatar
      redis.c split into many different C files. · e2641e09
      antirez authored
      networking related stuff moved into networking.c
      
      moved more code
      
      more work on layout of source code
      
      SDS instantaneuos memory saving. By Pieter and Salvatore at VMware ;)
      
      cleanly compiling again after the first split, now splitting it in more C files
      
      moving more things around... work in progress
      
      split replication code
      
      splitting more
      
      Sets split
      
      Hash split
      
      replication split
      
      even more splitting
      
      more splitting
      
      minor change
      e2641e09
  30. 19 Feb, 2010 1 commit
  31. 15 Jan, 2010 1 commit
  32. 23 Mar, 2009 1 commit
  33. 22 Mar, 2009 1 commit