I have ran the script that you provided and got the following results:

    int(635192)
    int(635944)

Which is far less than the peak memory result.

I use memory_get_peak_usage to measure what the worst case memory output
is in my application. I expect this to be the actual memory used (and
thus when the server starts swapping if this number exceeds the physical
memory).

Is my assertion about the meaning of memory_get_peak_usage incorrect?

Mike  

On Tue, 2011-06-07 at 16:28 +0200, David Zülke wrote:
> Please test the exact thing I suggested :)
> 
> var_dump(memory_get_usage());
> token_get_all(file_get_contents(<FILE>));
> gc_collect_cycles();
> var_dump(memory_get_usage());
> 
> memory_get_peak_usage() is irrelevant, and USE_ZEND_ALLOC won't give accurate 
> results anymore when looking at memory usage.
> 
> If the above gives the same numbers you got initially, then there's a memleak 
> in token_get_all().
> 
> David
> 
> 
> On 06.06.2011, at 22:30, Mike van Riel wrote:
> 
> > David and Pauli,
> > 
> > When I change the test script to:
> > 
> >    var_dump(memory_get_peak_usage());
> >    gc_collect_cycles();
> >    token_get_all(file_get_contents(<FILE>));
> >    gc_collect_cycles();
> >    var_dump(memory_get_peak_usage());
> > 
> > And execute the following bash line preceding:
> > 
> >    export USE_ZEND_ALLOC=0
> > 
> > I get the following output:
> > 
> >    int(8240)
> >    int(8240)
> > 
> > When I remove the gc_collect_cycles I get the same result.
> > Even assigning the results to a variable do not increase the peak memory.
> > 
> > FYI: When I change the argument of memory_get_peak_usage to 'true', I get 
> > the following results:
> > 
> >    int(262144)
> >    int(262144)
> > 
> > This amount is astoundingly less than the previous conclusions and less 
> > than my own calculations would show.
> > Of course this leads me to the following questions:
> > 
> > 1. Does it hurt to disable the Zend MM?
> > 2. Can it be done from inside a PHP Script?
> > 3. Why is the memory consumption so much lower, even lower than my 
> > calculations?
> > 
> > I assume it is a good thing to at least try to create an easy way to 
> > reproduce the issue (cannot include my test file) and create a bug report 
> > about this :)
> > 
> > Thank you for your assistance thus far.
> > 
> > Mike
> > 
> > On Sun, 5 Jun 2011 15:36:43 +0200, Julien Pauli wrote:
> >> Seems like leak.
> >> 
> >> Try disabling ZendMM to see if something noticeable happens (memory
> >> peak should be lower).
> >> USE_ZEND_ALLOC=0
> >> 
> >> Cheers,
> >> Julien
> >> 
> >> On Sun, Jun 5, 2011 at 2:01 PM, David Zülke
> >> <david.zue...@bitextender.com> wrote:
> >>> Smells like a memory leak if gc_collect_cycles() doesn't fix it.
> >>> 
> >>> David
> > 
> > 
> > 
> > -- 
> > PHP Internals - PHP Runtime Development Mailing List
> > To unsubscribe, visit: http://www.php.net/unsub.php
> > 
> > 
> 



--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to