I did some tests with memory_get_usage and memory_get_peak_usage.
One of my scripts returns 1.3mb and another 1.47mb.
it’s normal?
I would like to know when i need to care? how much memory.
thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes it is. It varies in the range as stated by Tadeck above.
Ofcourse you should be caring about it when their is a need for it. How much memory doesn’t have any fixed answer, however i am sure just by nitty-gitty changes in code, your memory consumption is not going to come down by much.
You must keep in mind following possible optimizations that you can make when the time come. One thing you can surely target doing is, disable all useless/unused modules inside php.ini . On my local dev box, i have about 55 modules for php enabled.
How PHP works is, for each and every request, it will initialize 55 modules which PHP has been configured with. Each module have it’s init, shutdown, cleanup steps during the lifecycle of the request, which consumes both time and memory.
For further reference you can read this post which explains all kind of internal details, which PHP request go through before printing even a simple “Hello World” on the browser.
http://abhinavsingh.com/blog/2008/11/how-does-php-echos-a-hello-world-behind-the-scene/