I've made this point before, but people often severly overestimate the total memory consumption of apache. They usually look at the resident set size of each apache process as reported by top, add them all up and decide apache is a huge pig. The problem is that generally, the resident set size includes shared libraries and memory even though those resources are shared by every apache process.
For example, look at top on my linode and tell me how much memory you think apache is using?:
Code:
top - 22:26:10 up 67 days, 11:55, 1 user, load average: 0.05, 0.02, 0.00
Tasks: 86 total, 1 running, 85 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni,100.0%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 368856k total, 323480k used, 45376k free, 15620k buffers
Swap: 524280k total, 3896k used, 520384k free, 177268k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
17402 www-data 16 0 146m 61m 54m S 0 17.0 0:32.83 apache2
19889 www-data 16 0 146m 60m 53m S 0 16.8 0:26.64 apache2
18368 www-data 16 0 146m 60m 52m S 0 16.7 0:31.21 apache2
21134 www-data 16 0 146m 58m 51m S 0 16.4 0:17.69 apache2
25082 www-data 16 0 146m 54m 47m S 0 15.2 0:04.42 apache2
2715 mysql 15 0 132m 52m 5140 S 0 14.5 196:11.57 mysqld
24524 www-data 19 0 144m 45m 39m S 0 12.5 0:05.30 apache2
1537 root 18 0 142m 7836 4600 S 0 2.1 0:19.02 apache2
61+60+60+58+52=291MB. But wait, I'm on a Linode 360, and 45MB is reported as free, 15MB is used for file buffers and 177MB is used by disk cache, on top of the 52MB used by mySQL. Clearly something doesn't add up
Assuming
this script I found is accurate, the actual memory consumption of all my Apache processes is 90MB. This is clearly much more than nginx (which I'm using to serve static files and reverse proxy to apache for dynamic pages), but is it really that much more that it would be if I was running PHP as fastCGI with 6 worker processes? I suspect not.
Back to the original question though, I have no idea why apache looks larger on CentOS, it could be that the default options to top are a little different, so it is actually measuring memory differently. It cold be that you are comparing 32-bit Ubuntu to 64-bit CentOS, or it could be that more modules are loaded on CentOS, or that they use different compiler optimizations, or...