--- memcached-trunk/memcached.c	2007-10-18 15:57:28.000000000 +0800
+++ memcached-new/memcached.c	2007-10-18 15:54:49.000000000 +0800
@@ -1366,6 +1366,7 @@ char *do_add_delta(item *it, const bool 
     char *ptr;
     int64_t value;
     int res;
+    item *new_it;
 
     ptr = ITEM_data(it);
     while ((*ptr != '\0') && (*ptr < '0' && *ptr > '9')) ptr++;    // BUG: can't be true
@@ -1384,20 +1385,17 @@ char *do_add_delta(item *it, const bool 
     }
     sprintf(buf, "%llu", value);
     res = strlen(buf);
-    if (res + 2 > it->nbytes) { /* need to realloc */
-        item *new_it;
-        new_it = do_item_alloc(ITEM_key(it), it->nkey, atoi(ITEM_suffix(it) + 1), it->exptime, res + 2 );
-        if (new_it == 0) {
-            return "SERVER_ERROR out of memory";
-        }
-        memcpy(ITEM_data(new_it), buf, res);
-        memcpy(ITEM_data(new_it) + res, "\r\n", 3);
-        do_item_replace(it, new_it);
-        do_item_remove(new_it);       /* release our reference */
-    } else { /* replace in-place */
-        memcpy(ITEM_data(it), buf, res);
-        memset(ITEM_data(it) + res, ' ', it->nbytes - res - 2);
+
+    /* just alloc one, not plan to new one only when res + 2 > it->nbytes */
+    new_it = do_item_alloc(ITEM_key(it), it->nkey, atoi(ITEM_suffix(it) + 1), it->exptime, res + 2 );
+
+    if (new_it == 0) {
+        return "SERVER_ERROR out of memory";
     }
+    memcpy(ITEM_data(new_it), buf, res);
+    memcpy(ITEM_data(new_it) + res, "\r\n", 3);
+    do_item_replace(it, new_it);
+    do_item_remove(new_it);       /* release our reference */
 
     return buf;
 }
