Raul Leaño Martinet
Raul Leaño Martinet

Reputation: 2113

Optimize PHP scripts

Do you know if there's a way to log how much memory is used in PHP scripts?.

I would like a log that tells me which objects are using more memory, which functions I need to improve, etc.

It would be something like memory_get_usage but for each line of code.

Upvotes: 1

Views: 142

Answers (1)

lafor
lafor

Reputation: 12776

Xdebug's execution trace might be closest to what you're looking for. It traces every include, function call and method call to a human-readable file that can optionally (with xdebug.show_mem_delta setting on) show the difference in memory usage between calls.

Upvotes: 1

Related Questions