# Fights memories leaks

- Thread: https://externals.io/message/24371
- Original archive: https://news-web.php.net/php.internals/24371
- Started by Michael Vergoz on 2006-07-14T01:07:17+00:00
- Messages: 1
- 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

---

## #24371 — Michael Vergoz — 2006-07-14T01:07:17+00:00

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

Hello,

 

That made one week that I fights against mem leaks in PHP and I already made a patch which corrects one of them. 

 

The biggest problem to which I face is to explain these leaks bus makes some I use my own SAPI prepared for an unknown HTTPd which is itself Fully-threaded and these leaks are visibles only in threaded environment. 

 

To regulate my problem I decided to make a program which insulates and tests any PHP scripts and makes it possible to see whether this one generates a leak in an threaded environment. 

 

The program consists of a modification of the SAPI embed (which I had already modified but there I still improved it without wanting it :d) and a small program which emulates the operation of a fully-threaded httpd server. 

I had posted a mail in connection with a leak in PG(last_error_message) & PG(last_error_file). Now you can reproduce the leak. 

 

I identified 4 others but it is necessary that I arrive has to find the exact script which reproduces the leak. I keep you informed.

 

In some case you can have a leak information coming from pthread_create() do not take care, that depends of  your NPTL (Native Posix Thread Library) version.

 

If you have any questions or advises i am available thanks.

The source code http://badcode.be/~descript/PHP/php_leak_tester.tar.gz
Installation : http://badcode.be/~descript/PHP/php_leak_tester/README
The patch for the first leak you can see with test/constant.php : http://badcode.be/~descript/PHP/PHP_5_2-php-main.diff


Michael Vergoz
