On Fri, 2006-03-31 at 20:50 -0800, Alan Bailward wrote: > Hey all. I recently swapped my apache 1.3 site (personal blog, albums, > etc) over to apache 2 (stable) and all seemed to go well. However > lately I've been having a lot of out of memory issues on the server. > Even when memory is still available <snip>
What output do you get from: top -b -n 1 For example, here is my apache output: [EMAIL PROTECTED] top -b -n 1 top - 11:48:06 up 2 days, 15:11, 2 users, load average: 0.00, 0.03, 0.04 Tasks: 88 total, 2 running, 86 sleeping, 0 stopped, 0 zombie Cpu(s): 7.4% us, 5.0% sy, 0.0% ni, 86.2% id, 0.8% wa, 0.0% hi, 0.5% si Mem: 2010484k total, 1678576k used, 331908k free, 264884k buffers Swap: 522104k total, 136k used, 521968k free, 945556k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 15536 root 16 0 56784 10m 4864 S 0.0 0.6 0:00.16 apache2 16374 apache 16 0 57188 9816 3108 S 0.0 0.5 0:00.10 apache2 6481 apache 15 0 57172 9780 3100 S 0.0 0.5 0:00.02 apache2 Go through top and see what is sucking up your memory. Or you can use gnome-system-monitor, which I like better. Here is a little program I tossed together to free that cached memory. Just run it and specify an amount of memory in MB. Do not run this as root, a normal user is fine. I have 2 GB and after running VMWare I run: mem 1200 Which frees all that cached memory that VMWare sucked up. If you have < 1 GB, you should turn swap off before you run this, otherwise you might just be allocating memory from swap and defeat the purpose. Before you run the program, look at the output of free to see how much you should try to free. For example, [EMAIL PROTECTED] free -m total used free shared buffers cached Mem: 1963 1643 319 0 258 923 -/+ buffers/cache: 461 1502 Swap: 509 0 509 I have 923 MB sitting in cache. So if I run: [EMAIL PROTECTED] mem 1200 allocating: 1200MB bytes of memory allocated: 1258291200MB bytes of memory freed 1258291200MB bytes of memory I now have 1.2 GB free: [EMAIL PROTECTED] free -m total used free shared buffers cached Mem: 1963 715 1248 0 45 307 -/+ buffers/cache: 362 1600 Swap: 509 0 509 To compile the program, just do: You can replace $CFLAGS with whatever you like, for example -O3. [EMAIL PROTECTED] gcc $CFLAGS -o mem mem.c [EMAIL PROTECTED] sudo cp mem /usr/bin -------- BEGIN CUT -------- #include <stdlib.h> #include <stdio.h> int main(int argc, char* argv[]) { char* ptr = 0; int i = 0; int size = 0; if (argc != 2) { printf("Usage: %s SIZE\nwhere SIZE is the size of " "memory to allocate in MB\n", argv[0]); return 1; } /* get the size in MB from the command line */ size = atoi(argv[1]); printf("allocating: %iMB bytes of memory\n", size); ptr = (char*)malloc(1024 * 1024 * size); if (ptr) { printf("allocated: %iMB bytes of memory\n", (1024 * 1024 * size)); for (i=0; i<(1024 * 1024 * size); i++) { ptr[i]=1; } free(ptr); printf("freed %iMB bytes of memory\n", (1024 * 1024 * size)); } else printf("failed to allocate %iMB bytes of memory\n", (1024 * 1024 * size)); return 0; } -------- END CUT -------- You might want to try: # mem 225 Jim -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- I'm a geek, but I don't get it. 36-24-36 = -24. What's the significance? =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Florida, USA, Earth, Solar System, Milky Way -- gentoo-user@gentoo.org mailing list