There are two commands in PHP - memory_get_usage() and 
memory_get_peak_usage(). 

http://php.net/manual/en/function.memory-get-usage.php
http://www.php.net/manual/en/function.memory-get-peak-usage.php

This page actually how you can use the function to help detect memory leaks 
in areas of code. (If the memory does not return back to the same number 
before entering the desired function, then there maybe a memory leak within 
that function.

On Friday, July 13, 2012 3:40:27 PM UTC-4, Adam Monsen wrote:
>
> Just for fun, suppose you were 
>
> * using the Symfony2 framework 
> * writing a long-running PHP daemon process 
> * using monolog 
> * using the fingers-crossed handler at 'error', grouped with 
>   a stream handler at 'info' 
> * logging lots of info() messages in said long-running process 
> * using a buffer_size of 0 for said handler(s) 
>
> Is this just asking for a memory leak? 
>
> Looks like the default buffer_size is 0, meaning it will buffer forever 
> if an 'error' message is never handled. 
>
> Here's my logging config (did you really think this was just a 
> hypothetical?): 
>
> monolog: 
>     handlers: 
>         main: 
>           type:         fingers_crossed 
>           action_level: error 
>           handler:      grouped 
>         grouped: 
>           type: group 
>           members: [nested, mylog] 
>         nested: 
>           type:  stream 
>           path:  %kernel.logs_dir%/%kernel.environment%.log 
>           level: info 
>         mylog: 
>           type: service 
>           id: adams_custom_log_handler 
>           level: warning 
>
> Something tells me that most use of PHP is short-running, and a 
> long-running daemon written in PHP is going to have many memory leaks, 
> if not from PHP core, from the many libraries only considering their 
> code will be used from within anything besides long-running PHP processes. 
>
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en

Reply via email to