Comment #5 on issue 115 by [email protected]: item_size_ok doesn't account
for CAS
http://code.google.com/p/memcached/issues/detail?id=115
actually it's not a mem leak.. but an edge case when using CAS and size
gets close to a slab barrier (promoted to next slab class) .. or if close
to max size, it might have some bad behavior (first getting cleared to fit
in the biggest slab, then getting rejected .. or worse losing data?)
in do_item_alloc() CAS is accounted for to determine slab class:
size_t ntotal = item_make_header(nkey + 1, flags, nbytes, suffix,
&nsuffix);
if (settings.use_cas) {
ntotal += sizeof(uint64_t);
}
unsigned int id = slabs_clsid(ntotal);
yet in item_size_ok() we don't add those 8 bytes to the picture:
return slabs_clsid(item_make_header(nkey + 1, flags, nbytes,
prefix, &nsuffix)) != 0;
not sure how to generate a test case.. maybe just need to present a KV that
is close in size to the edge of 1MB - 4B ? is CAS normally off (in which
case this is masked..)?