Re: Memory leak detection
| From: | Antony Dovgal | Date: | Thu, 19 Nov 2009 11:58:15 +0000 |
| Subject: | Re: Memory leak detection | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-6797@lists.php.net to get a copy of this message | ||
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?
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
--
Wbr,
Antony Dovgal
---
http://pinba.org - realtime statistics for PHP