Re: Memory leak detection
| From: | Pierre Joye | Date: | Fri, 20 Nov 2009 11:27:20 +0000 |
| Subject: | Re: Memory leak detection | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6804@lists.php.net to get a copy of this message | ||
hi Gustavo,
I'm not sure why but the ZMM seems to be broken in some cases, unix or
windows, as leaks are not reported. I can't do much to fix that right
now :)
However there are alternatives, on windows you can use
--enable-crt-debug and disable the MM usage (set USE_ZEND_ALLOC=0
first in the cmd line) and it will report some leaks. There is also
tools to detect leaks on windows, some are free like
ApplicationVerifier (MS tool), windbg can help as well.
Cheers,
On Fri, Nov 20, 2009 at 3:32 AM, Gustavo Lopes <glopes@nebm.ist.utl.pt> wrote:
> On Thu, 19 Nov 2009 11:58:15 -0000, Antony Dovgal <tony@daylessday.org>
> wrote:
>
>> On 19.11.2009 09:19, Gustavo Lopes wrote:
>>>
>>> Hi, I've read that PHP compiled in debug mode was supposed to warn of
>>> memory leaks.
>>>
>>> I've tried to add an obvious memory leak, but got no messages:
>>>
>>> (...)
>>> void *a = emalloc(200);
>>> printf("%d", *((int*)a));
>>> (...)
>>>
>>>> php.exe 006.php
>>>
>>> 15158708101515870810
>>> (nothing more)
>>>
>>>> php.exe -i | findstr cscript
>>>
>>> Configure Command => cscript /nologo configure.js "--enable-debug"
>>> "--enable-crt-debug"
>>>
>>> Did I do anything wrong?
>>
>> Do you have report_memleaks = On in your php.ini?
>
> Now I do, but it didn't help.
>
>> I would also suggest using valgrind to detect memleaks, but don't forget
>> to --enable-debug and export USE_ZEND_ALLOC=0 env var.
>> Here is the line I use:
>> USE_ZEND_ALLOC=0 valgrind --tool=memcheck --leak-check=yes
>> --num-callers=30 --show-reachable=yes php script.php
>>
>
> There's no valgrind for windows.
>
> I already lost 2 hours with this. I'll try the windows internals list
> tomorrow.
>
> Thanks anyway
>
> --
> Gustavo Lopes
>
> --
> PECL development discussion Mailing List (http://pecl.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Pierre
http://blog.thepimp.net | http://www.libgd.org