Out of memory < 64M?

Jeremy Wohl jeremyw-memcached at igmus.org
Mon May 16 12:58:59 PDT 2005


Hey folks,

I seem to be getting eventual "SERVER_ERROR out of memory" msgs when using
less than the default 64M max memory (determined by trial-and-error.)

The following list post conjectures a 15M min -- has this changed in
recent versions?

    http://lists.danga.com/pipermail/memcached/2004-April/000566.html

How about something like the following?

--- memcached.c.orig    2005-05-16 02:45:08.346132584 -0500
+++ memcached.c 2005-05-16 02:48:02.443665736 -0500
@@ -56,6 +56,8 @@
 static int delcurr;
 static int deltotal;
 
+#define MINIMUM_MAXBYTES 64*1024*1024
+
 time_t realtime(time_t exptime) {
     time_t now;
 
@@ -88,7 +90,7 @@
 void settings_init(void) {
     settings.port = 11211;
     settings.interface.s_addr = htonl(INADDR_ANY);
-    settings.maxbytes = 64*1024*1024; /* default is 64MB */
+    settings.maxbytes = MINIMUM_MAXBYTES; /* default and minimum is 64MB */
     settings.maxconns = 1024;         /* to limit connections-related memory to about 5MB */
     settings.verbose = 0;
     settings.oldest_live = 0;
@@ -1361,6 +1363,10 @@
             break;
         case 'm':
             settings.maxbytes = atoi(optarg)*1024*1024;
+            if (settings.maxbytes < MINIMUM_MAXBYTES) {
+                fprintf(stderr, "Max memory must be at least 64M");
+                return 1;
+            }
             break;
         case 'M':
             settings.evict_to_free = 0;

--- memcached.1.myorig  2005-05-16 02:45:30.941697536 -0500
+++ memcached.1 2005-05-16 02:44:43.249947784 -0500
@@ -32,7 +32,7 @@
 Assume the identity of <username> (only when run as root).
 .TP
 .B \-m <num>
-Use <num> MB memory max to use for object storage; the default is 64 megabytes.
+Use <num> MB memory max to use for object storage; the default and minimum is 64 megabytes.
 .TP
 .B \-M
 Instead of throwing items from the cache when max memory is reached, throw an 

thanks,
-jeremy
_____________________________________________________________________
jeremy wohl ..: http://igmus.org


More information about the memcached mailing list