I consistently get an out of memory error when performing  < 44 byte (key+data) puts to memcache, but when 'put'-ing the same key with data that is long enough to exceed 44 chars key + data  , I succeed.  I observe this behavior using both the ruby client (memcache-client 
1.5) and the python one (python-memcached), although the python client seems to break at 59 chars, rather than 44.<br><br>I see something vaguely similar on the lists in early 2006:<br><a href="http://www.nabble.com/%22SERVER_ERROR-out-of-memory%22-when-changing-cache-entry-pattern-t4346764.html">
http://www.nabble.com/%22SERVER_ERROR-out-of-memory%22-when-changing-cache-entry-pattern-t4346764.html</a><br><br>but my error is consistent, where theirs seems to have been sporadic.<br><br><br><br>I&#39;m running memcached 
1.2.2 with the following options:<br><br>memcached -d -p 11211 -u nobody -c 1024 -m 3072<br><br>The offending servers are recent CentOS running 3G of cache each on 32-bit boxes with 4G ram-if it matters, I can get details about these.
<br><br><br><br>Very detailed:<br><br>Here is a ruby console session,<br><br>&gt;&gt; s = &quot;1234567890&quot; * 100<br>=&gt; &quot;1234567890.....{long string elided for brevity.}&quot;<br>&gt;&gt; s.first(10)<br>=&gt; &quot;1234567890&quot;
<br>&gt;&gt; CACHE.set(&#39;foo&#39;, s.first(1))<br>MemCache::MemCacheError: out of memory<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/lib/ruby/gems/1.8/gems/memcache-client-1.5.0/lib/memcache.rb:307:in `set&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):16<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0
<br>&gt;&gt; CACHE.set(&#39;foo&#39;, s.first(50))<br>=&gt; nil<br>&gt;&gt; CACHE.get(&#39;foo&#39;)<br>=&gt; &quot;12345678901234567890123456789012345678901234567890&quot;<br>&gt;&gt; CACHE.set(&#39;foo&#39;, s.first(30))
<br>MemCache::MemCacheError: out of memory<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/lib/ruby/gems/1.8/gems/memcache-client-1.5.0/lib/memcache.rb:307:in `set&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):31<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0<br>&gt;&gt; CACHE.set(&#39;foo&#39;, 
s.first(40))<br>=&gt; nil<br>&gt;&gt; CACHE.get(&#39;foo&#39;)<br>=&gt; &quot;1234567890123456789012345678901234567890&quot;<br>&gt;&gt; CACHE.set(&#39;foo&#39;, s.first(32))<br>MemCache::MemCacheError: out of memory<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/lib/ruby/gems/1.8/gems/memcache- 
client-1.5.0/lib/memcache.rb:307:in `set&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):34<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0<br>&gt;&gt; CACHE.set(&#39;foo&#39;, s.first(33))<br>=&gt; nil<br>&gt;&gt; CACHE.get(&#39;foo&#39;)<br>=&gt; &quot;123456789012345678901234567890123&quot;
<br>&gt;&gt; CACHE.get(&#39;foobar&#39;)<br>=&gt; nil<br>&gt;&gt; CACHE.set(&#39;foobar&#39;, s.first(32))<br>=&gt; nil<br>&gt;&gt; CACHE.get(&#39;foobar&#39;)<br>=&gt; &quot;12345678901234567890123456789012&quot;<br>&gt;&gt; 
CACHE.set(&#39;foobar&#39;, s.first(30))<br>=&gt; nil<br>&gt;&gt; CACHE.get(&#39;foobar&#39;)<br>=&gt; &quot;123456789012345678901234567890&quot;<br>&gt;&gt; CACHE.set(&#39;foobar&#39;, s.first(29))<br>MemCache::MemCacheError: out of memory
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from /usr/lib/ruby/gems/1.8/gems/memcache-client-1.5.0/lib/memcache.rb:307:in `set&#39;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from (irb):47<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; from :0<br><br><br>So it looks like anything under 36 bytes (key + data) has a problem. The client I use prefixes keys with an 8-char string, so that&#39;s actually 44 chars key + data
<br><br>Using python-memcached, I got substantially the same results, only the break happened at 59 chars key + data.<br><br>&gt;&gt;&gt; s = &quot;1234567890&quot; * 10<br>&gt;&gt;&gt; mc.set(&quot;key&quot;, s[0:56])<br>
1<br>&gt;&gt;&gt; mc.get(&quot;key&quot;)<br>&#39;12345678901234567890123456789012345678901234567890123456&#39;<br><br>&gt;&gt;&gt; mc.set(&quot;key&quot;, s[0:55])<br>MemCached: while expecting &#39;STORED&#39;, got unexpected response &#39;SERVER_ERROR out of memory&#39;
<br>1<br>&gt;&gt;&gt; mc.get(&quot;key&quot;)<br>&#39;12345678901234567890123456789012345678901234567890123456&#39;<br>&gt;&gt;&gt; mc.set(&quot;k&quot;, s[0:56])<br>MemCached: while expecting &#39;STORED&#39;, got unexpected response &#39;SERVER_ERROR out of memory&#39;
<br>1<br>&gt;&gt;&gt; mc.set(&quot;k&quot;, s[0:58])<br>1<br>&gt;&gt;&gt; mc.get(&quot;k&quot;)<br>&#39;1234567890123456789012345678901234567890123456789012345678&#39;<br><br><br><br>If it matters, here is the response from stats:
<br><br>&gt;&gt; CACHE.stats<br>=&gt; {&quot;x.x.x.x:11211&quot;=&gt;{&quot;bytes&quot;=&gt;2678831108, &quot;pid&quot;=&gt;2613, &quot;connection_structures&quot;=&gt;47, &quot;threads&quot;=&gt;4, &quot;evictions&quot;=&gt;7397, &quot;time&quot;=&gt;1191948397, &quot;pointer_size&quot;=&gt;32, &quot;limit_maxbytes&quot;=&gt;3221225472, &quot;cmd_get&quot;=&gt;54170155, &quot;version&quot;=&gt;&quot;
1.2.2&quot;, &quot;bytes_written&quot;=&gt;37964380497, &quot;cmd_set&quot;=&gt;25110788, &quot;get_misses&quot;=&gt;11659284, &quot;total_connections&quot;=&gt;2041765, &quot;curr_connections&quot;=&gt;43, &quot;curr_items&quot;=&gt;4374286, &quot;uptime&quot;=&gt;2334717, &quot;get_hits&quot;=&gt;42510871, &quot;total_items&quot;=&gt;25110788, &quot;rusage_system&quot;=&gt;
2039.975876, &quot;rusage_user&quot;=&gt;612.713853, &quot;bytes_read&quot;=&gt;75534170186}, &quot;x.x.x.y:11211&quot;=&gt;{&quot;bytes&quot;=&gt;2678220092, &quot;pid&quot;=&gt;2516, &quot;connection_structures&quot;=&gt;47, &quot;threads&quot;=&gt;4, &quot;evictions&quot;=&gt;10624, &quot;time&quot;=&gt;1191951946, &quot;pointer_size&quot;=&gt;32, &quot;limit_maxbytes&quot;=&gt;3221225472, &quot;cmd_get&quot;=&gt;56914534, &quot;version&quot;=&gt;&quot;
1.2.2&quot;, &quot;bytes_written&quot;=&gt;34812915115, &quot;cmd_set&quot;=&gt;25042621, &quot;get_misses&quot;=&gt;11378051, &quot;total_connections&quot;=&gt;2041833, &quot;curr_connections&quot;=&gt;43, &quot;curr_items&quot;=&gt;4542475, &quot;uptime&quot;=&gt;2334736, &quot;get_hits&quot;=&gt;45536483, &quot;total_items&quot;=&gt;25042621, &quot;rusage_system&quot;=&gt;
2115.619376, &quot;rusage_user&quot;=&gt;631.239037, &quot;bytes_read&quot;=&gt;75855048310}}<br clear="all"><br>