Allocating memory beyond mem_limit if p->slabs <= 0

Chris Eberly chris.eberly at gmail.com
Fri Oct 26 21:15:32 UTC 2007


Hello,
We are working on optimizing our memcached configuration and I came across
something I don't understand. It seems as though you are able to allocate a
slab (and therefore more memory) even if you have passed the command line
memory limit with other slabs. The code in question is in slabs.c in
do_slabs_newslab():

    if (mem_limit && mem_malloced + len > mem_limit && p->slabs > 0)
        return 0;

So I can theoretically allocate 1 of each type of slab I don't have yet even
if I am passed my memory limit. While it turns out this is advantageous (or
at worst irrelevant because of the scale of the memory we are using), I am
wondering what the rationale behind this code is?


Chris Eberly
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.danga.com/pipermail/memcached/attachments/20071026/6a9683f9/attachment.html


More information about the memcached mailing list