Re: How to measure memory leakage/usage in PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Chris,

  Thanks for such quick response.

quite good suggestion, but my application is using a framework and lots of
includes and even autoloads of classes are being done, so using break point
approach is not possible for me.

Well, trying to do something so I can call my memory usage function after
certain number of lines or predefined life time of php script, any
suggestion?

Thanks and Regards
Zareef Ahmed

On 3/6/08, Chris <dmagick@xxxxxxxxx> wrote:
>
> Zareef Ahmed wrote:
> > Hi All,
> >
> >    I am looking into the concepts behind memory management in PHP. Which
> > kind of approach will be best to measure memory leakage or usage in a
> PHP
> > script?
> >
> > I can measure my apache process but is there any way by which I can know
> > which exact part of script is consuming how much memory?
>
>
> Start off with putting something like this:
>
> error_log('in file ' . __FILE__ . ' at line ' . __LINE__ . ' memory
> usage is ' . memory_get_usage(true) . "\n", 3, '/path/to/log.file');
>
> every 100 lines and work out where your spikes are.
>
> When you're looking at a section that jumps a lot, put it every 10 lines
> - work out which parts are causing the big jumps and go from there.
>
>
> Or use xdebug profiling to work out which parts of your app are being
> used the most and start there - http://xdebug.org/docs/profiler
>
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>



-- 
Zareef Ahmed
http://www.zareef.net
A PHP Developer in India

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux