# Problem with leak detection

- Thread: https://externals.io/message/16804
- Original archive: https://news-web.php.net/php.internals/16804
- Started by Marcus Boerger on 2005-06-20T02:19:27+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #16804 — Marcus Boerger — 2005-06-20T02:19:27+00:00

URL: https://externals.io/message/16804#16804

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

---

## #16807 — Michael Wallner — 2005-06-20T17:53:20+00:00

URL: https://externals.io/message/16804#16807 · In reply to: #16804

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

---

## #16810 — Wez Furlong — 2005-06-20T20:55:43+00:00

URL: https://externals.io/message/16804#16810 · In reply to: #16807

That should probably just be:

#if PHP_WIN32
     OutputDebugString(...);
#endif
     fprintf(stderr, ...);


> 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.

---

## #16812 — Marcus Boerger — 2005-06-20T23:29:15+00:00

URL: https://externals.io/message/16804#16812 · In reply to: #16810

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, ...);

> 
> > […]

> --
> 
> 




-- 
Best regards,
 Marcus                            mailto:mail@marcus-boerger.de

---

## #16856 — Zeev Suraski — 2005-06-22T14:03:35+00:00

URL: https://externals.io/message/16804#16856 · In reply to: #16804

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:
>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

---

## #16868 — Marcus Boerger — 2005-06-23T00:17:51+00:00

URL: https://externals.io/message/16804#16868 · In reply to: #16856

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:

> 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:
> > […]
