简体   繁体   中英

How to find memory consumption of a php script?

I am running a php script as a process on a Linux shell. With different tools (top, xdebug, ...) I see the dynamic memory consumption (heap memory) of this very complex script continuously rising.

How can I find out exactly the line in the code or the variable or the place, that is causing this behavior? Where is the memory leak of the php script?

Additional information:

  • Linux version 2.6.30-gentoo-r4
  • PHP Version 5.2.10-pl0-gentoo
  • I can modify the script
  • I can use xdebug

Please give a reason for closing this question.

Try this at suspect areas

echo memory_get_usage();

// Suspect code here

echo memory_get_usage();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM