Alex
Alex

Reputation: 44395

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:

Please give a reason for closing this question.

Upvotes: 0

Views: 155

Answers (1)

crafter
crafter

Reputation: 6297

Try this at suspect areas

echo memory_get_usage();

// Suspect code here

echo memory_get_usage();

Upvotes: 1

Related Questions