Problem with leak detection

php.internals

Marcus Boerger

21 years ago
Hello internals, i just stumbled over a strange issue while testing. Some of my tests have exit(0) at the end for easier test verification. Now i found a new one that has a few memleaks but only reports them if i drop that exit(0) line. Is this something we need to fix (e.g. exit() omits leakage info)?
-- Best regards, Marcus mailto:mail@marcus-boerger.de

Michael Wallner

21 years ago
Marcus Boerger wrote:
> i just stumbled over a strange issue while testing. Some of my tests > have exit(0) at the end for easier test verification. Now i found a new > one that has a few memleaks but only reports them if i drop that exit(0) > line. Is this something we need to fix (e.g. exit() omits leakage info)?
Sorry, but I cannot speak for exit(), but I usually replace all occurrences of #if PHP_WIN32 OutputDebugString(...); #else fprintf(stderr, ...); #endif with just fprintf(stderr, ...) to see any mem-leaks on Win32-CLI. JFYI. Regards,
-- Mike

Wez Furlong

21 years ago
That should probably just be: #if PHP_WIN32 OutputDebugString(...); #endif fprintf(stderr, ...); On 6/20/05, Michael Wallner <mike@php.net> wrote:

Marcus Boerger

21 years ago
Hello Wez, i used linux so there seems to be a problem with either flushing or the fprintf not being called at all. regards marcus Monday, June 20, 2005, 10:55:43 PM, you wrote:
> That should probably just be:
> #if PHP_WIN32 > OutputDebugString(...); > #endif > fprintf(stderr, ...);
> On 6/20/05, Michael Wallner <mike@php.net> wrote: >> Sorry, but I cannot speak for exit(), but I usually replace all occurrences of >> >> #if PHP_WIN32 >> OutputDebugString(...); >> #else >> fprintf(stderr, ...); >> #endif >> >> with just fprintf(stderr, ...) to see any mem-leaks on Win32-CLI.
> -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php
-- Best regards, Marcus mailto:mail@marcus-boerger.de

Zeev Suraski

21 years ago
When exit() is called, like any other case in which zend_bailout() is used, there can be memory blocks which will not be 'properly' freed, and we have to rely on the memory manager to free it. So the fact leaks are not shown in case of exit() is intentional. Zeev At 05:19 20/06/2005, Marcus Boerger wrote:

Marcus Boerger

21 years ago
Hello Zeev, thanks for clarifying. Any chance we could change that for "normal/unproblemeatic" exit()s in the future with run-tests in mind? marcus Wednesday, June 22, 2005, 4:03:35 PM, you wrote:

Zeev Suraski

21 years ago
At 03:17 23/06/2005, Marcus Boerger wrote:
>Hello Zeev, > > thanks for clarifying. Any chance we could change that for >"normal/unproblemeatic" exit()s in the future with run-tests >in mind?
The trick would be how we can detect a non problematic exit(). For example, function foo() { exit(); } function bar($arg1, $arg2) { } bar("foo" . "bar", foo()); (or something similar, I didn't actually test it) would result in a leak, even though it's perfectly normal/unproblematic... Zeev

Derick Rethans

21 years ago
On Thu, 23 Jun 2005, Zeev Suraski wrote:
> At 03:17 23/06/2005, Marcus Boerger wrote: > >Hello Zeev, > > > > thanks for clarifying. Any chance we could change that for > >"normal/unproblemeatic" exit()s in the future with run-tests > >in mind? > > The trick would be how we can detect a non problematic exit(). For example, > > function foo() { exit(); } > > function bar($arg1, $arg2) { } > > bar("foo" . "bar", foo()); > > (or something similar, I didn't actually test it) would result in a leak, even > though it's perfectly normal/unproblematic...
And this is why I had to overload the EXIT opcode for Xdebug's code coverate and profiling to work ;-) Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org