keeping memory usage at certain limit

Salvatore Sanfilippo antirez at
Tue Apr 29 05:36:17 PDT 2014


Redis files zmalloc.[ch] contain an implementation of a jemalloc
wrapper that can track the size of the currently allocated memory, as
the sum of all the individual allocations, plus functions to get the
ratio between the actual resident set size of the process and this
sum, in order to obtain the fragmentation level. This is used as a
base to implement Redis "maxmemory" directive that looks similar to
what you want.

Source code (BSD licensed) here:


On Tue, Apr 29, 2014 at 2:29 PM, Antony Dovgal <antony.dovgal at> wrote:
> On 04/29/2014 03:28 PM, Bradley C. Kuszmaul wrote:
>> Are transparent huge pages enabled? Does disabling them help?  (If so, you
>> may be able to thus workaround, and perhaps jemalloc could be improved.)
> From what I can see, they are disabled:
> $ cat /sys/kernel/mm/transparent_hugepage/enabled
> always madvise [never]
> --
> Wbr,
> Antony Dovgal
> _______________________________________________
> jemalloc-discuss mailing list
> jemalloc-discuss at

Salvatore 'antirez' Sanfilippo
open source developer - GoPivotal

To "attack a straw man" is to create the illusion of having refuted a
proposition by replacing it with a superficially similar yet
unequivalent proposition (the "straw man"), and to refute it
       — Wikipedia (Straw man page)

More information about the jemalloc-discuss mailing list