20 Commits

Author SHA1 Message Date
antirez
9d8ceca2b8 zmalloc.c: remove thread safe mode, it's the default way. 2017-05-09 16:59:51 +02:00
antirez
e901b0edbf Defrag: activate it only if running modified version of Jemalloc.
This commit also includes minor aesthetic changes like removal of
trailing spaces.
2017-01-10 11:25:39 +01:00
oranagra
c053025a0a active memory defragmentation 2016-12-30 03:37:52 +02:00
antirez
7e86bce6b0 zmalloc: zmalloc_get_smap_bytes_by_field() modified to work for any PID.
The goal is to get copy-on-write amount of the child from the parent.
2016-09-19 10:28:42 +02:00
antirez
fece4bf209 getMemorySize() moved into zmalloc.c with other low level mem utils.
See issue #2218.
2014-12-17 17:11:20 +01:00
antirez
0775665453 THP detection / reporting functions added. 2014-11-12 10:43:32 +01:00
antirez
d84c84f268 Sample and cache RSS in serverCron().
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.
2014-03-24 12:00:20 +01:00
antirez
be336f7764 zmalloc_get_private_dirty() function added (Linux only).
For non Linux systmes it just returns 0.

This function is useful to estimate copy-on-write because of childs
saving stuff on disk.
2012-11-19 11:47:35 +01:00
antirez
9b0b9ed3c3 Better Out of Memory handling.
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).
2012-08-24 12:55:37 +02:00
antirez
39f8289c41 Jemalloc updated to 3.0.0.
Full changelog here:

http://www.canonware.com/cgi-bin/gitweb.cgi?p=jemalloc.git;a=blob_plain;f=ChangeLog;hb=master

Notable improvements from the point of view of Redis:

1) Bugfixing.
2) Support for Valgrind.
3) Support for OSX Lion, FreeBSD.
2012-05-16 11:09:45 +02:00
Premysl Hruby
e5ea388f99 future-proof version comparison 2012-04-05 10:41:28 +02:00
antirez
1b060d2658 Produce the watchlog warning log in a way that is safer from a signal handler. Fix a memory leak in the backtrace generation function. 2012-03-27 15:24:33 +02:00
antirez
f57707f408 Precision of getClientOutputBufferMemoryUsage() greatily improved, see issue #327 for more information. 2012-02-07 13:05:36 +01:00
antirez
f60fcf2c76 no more allocation stats info in INFO, useless now that we have jemalloc. 2011-07-02 10:31:16 +02:00
antirez
00b6545b4f forward-ported changes in zmalloc.c/h to support jemalloc build 2011-06-20 11:34:04 +02:00
antirez
e3401df98d allocation stats in INFO 2011-01-09 15:56:50 +01:00
antirez
4e0d189300 zmalloc functions to get RSS and fragmentation refactored into two separated functions 2010-11-02 10:51:09 +01:00
antirez
eddb388ef9 memory fragmentation ratio in INFO output 2010-09-02 10:34:39 +02:00
Benjamin Kramer
399f2f401c Add zcalloc and use it where appropriate
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.
2010-07-25 00:11:20 +02:00
antirez
e2641e09cc redis.c split into many different C files.
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
2010-07-01 14:38:51 +02:00