1

Lately, I've been spending time trying to optimise PHP code. I develop on localhost inside a VM and have been putting the memory_get_usage() at the end of scripts to help do this.

The localhost uses the same configuration as the live Apache 2.2 server but for some reason, I notice the function returns two different values. On the live server it always returns 10-14x more memory being used than the localhost.

Does anyone know why this is?

3
  • 1
    Do you use same versions of Apache and php5 on both servers? Are both 64bit/32bit? Is there a huge difference between available memory?
    – Olli
    Jan 30, 2014 at 14:01
  • Sorry for late reply. I had email notifications on and didn't get any so I thought no one answered... Yes, Apache and PHP5 on both. However, the live server is 64 bit and the VM is 32bit. If you mean amount of free available memory, they are the same until the Apache processes launch... Then the live server shows the processes taking up 2x amount of RAM per process.
    – Ken
    Feb 4, 2014 at 19:05
  • Hmm. 2x amount of RAM per process, but memory_get_usage() shows 10-14x more?
    – Olli
    Feb 18, 2014 at 14:35

0

You must log in to answer this question.

Browse other questions tagged .