Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Can anyone explain why the same PHP application running on a Windows server reports memory_get_peak_usage() as ~3.25mb, but on OS X gives ~19.5mb?

Obviously one is very wrong, but I don't know which to believe.

share|improve this question
First obvious thing to ask is are you running the same version of PHP on both, with exactly the same modules loaded? – kaerast Jun 11 '10 at 17:32
Yup both running the same version of PHP. All the same extensions as far as I'm aware, although I've not checked every extension version. – Jack Sleight Jun 11 '10 at 18:52
up vote 0 down vote accepted

What SAPI (server API) is php run under? With some SAPI's, the memory_usage functions return the memory of the entire process (including the PHP interpreter and web server client) whereas others return just the scripts memory usage (Minus the overhead). So likely neither is wrong, they are just describing different things...

share|improve this answer
Well they're both running as modules under Apache, so I thought they should be the same? Maybe not though? – Jack Sleight Jun 11 '10 at 18:50
@Jack Sleight: Both under mod_php? What worker style (prefork? threaded?)? I think tracking down the differences would be your best bet for figuring out what's going on... – ircmaxell Jun 11 '10 at 19:07
Both under mod_php yes, but "What worker style (prefork? threaded?)?" is a bit beyond my knowledge... I'll try to find out. – Jack Sleight Jun 18 '10 at 14:29

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.