Re: Trying to find out where the memory went

From: Date: Tue, 07 Jun 2011 14:28:25 +0000
Subject: Re: Trying to find out where the memory went
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
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
>> <[email protected]> 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
> 
> 



Attachment: [application/pkcs7-signature] smime.p7s

Thread (18 messages)

« previous php.internals (#53145) next »