# Memory leak in include()/require() ?

- Thread: https://externals.io/message/67431
- Original archive: https://news-web.php.net/php.internals/67431
- Started by peter wang on 2013-05-16T09:24:19+00:00
- Messages: 9
- 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

---

## #67431 — peter wang — 2013-05-16T09:24:19+00:00

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

hi, did anyone come across the memory leak of require()/include(),
I just saw this bug report: https://bugs.php.net/bug.php?id=47038, 
but it was closed with nothing explained.


the php version I used:

php --version
PHP 5.3.6-13ubuntu3.9 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:27)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

---

## #67432 — Stas Malyshev — 2013-05-16T09:40:39+00:00

URL: https://externals.io/message/67431#67432 · In reply to: #67431

Hi!

> hi, did anyone come across the memory leak of require()/include(),
> I just saw this bug report: https://bugs.php.net/bug.php?id=47038, 
> but it was closed with nothing explained.

This bug report was closed because the bug it describes was fixed. It is
explained so right on the bug page.

> the php version I used:
> 
> php --version
> PHP 5.3.6-13ubuntu3.9 with Suhosin-Patch (cli) (built: Sep 12 2012 19:00:27)
> Copyright (c) 1997-2011 The PHP Group
> Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

If you see the memory leak with current version (5.4.15/5.3.25) please
submit a bug report containing the reproduction script and what happens
when you run it. See the guidelines here:
https://bugs.php.net/how-to-report.php


-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #67433 — Peter Wang — 2013-05-16T09:47:15+00:00

URL: https://externals.io/message/67431#67433 · In reply to: #67432

I didn't find the history comments of that bug, now I see it, anyway,
thanks a lot, sorry for the noise.


On Thu, May 16, 2013 at 11:40 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > […]
>
> This bug report was closed because the bug it describes was fixed. It is
> explained so right on the bug page.
>
> > […]
> 19:00:27)
> > […]
>
> If you see the memory leak with current version (5.4.15/5.3.25) please
> submit a bug report containing the reproduction script and what happens
> when you run it. See the guidelines here:
> https://bugs.php.net/how-to-report.php
>
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227

---

## #67434 — Peter Wang — 2013-05-16T11:25:42+00:00

URL: https://externals.io/message/67431#67434 · In reply to: #67432

Hi,

I found that the memory leak is actually related to APC,
even with the latest version of PHP (5.3.25) and latest version of APC
(3.1.13),
the memory leak is still there, to re-produce the bug,
just run this script and watch the memory usage of the php process
(please run with: php -d apc.enable_cli=1 )

<?php

touch('file1.php');
while (true) {
    $file = 'file1.php';
    require($file);
}

if run with  -dapc.enable_cli=0, it does not leak memory.

thanks.


On Thu, May 16, 2013 at 11:40 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > […]
>
> This bug report was closed because the bug it describes was fixed. It is
> explained so right on the bug page.
>
> > […]
> 19:00:27)
> > […]
>
> If you see the memory leak with current version (5.4.15/5.3.25) please
> submit a bug report containing the reproduction script and what happens
> when you run it. See the guidelines here:
> https://bugs.php.net/how-to-report.php
>
>
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227

---

## #67435 — Stas Malyshev — 2013-05-16T18:57:08+00:00

URL: https://externals.io/message/67431#67435 · In reply to: #67434

Hi!

> I found that the memory leak is actually related to APC,
> even with the latest version of PHP (5.3.25) and latest version of APC
> (3.1.13),

Please submit the bug on bugs.php.net with package "apc" - putting there
reproducing script and describing exactly what you see when it is running.

Thanks,
-- 
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

---

## #67436 — Peter Wang — 2013-05-16T19:07:31+00:00

URL: https://externals.io/message/67431#67436 · In reply to: #67435

Hi,
the bug report is here:  https://bugs.php.net/bug.php?id=64859

thanks.


On Thu, May 16, 2013 at 8:57 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:

> Hi!
>
> > […]
>
> Please submit the bug on bugs.php.net with package "apc" - putting there
> reproducing script and describing exactly what you see when it is running.
>
> Thanks,
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227

---

## #67437 — Leigh — 2013-05-17T07:42:00+00:00

URL: https://externals.io/message/67431#67437 · In reply to: #67436

> > […]

Just to make sure it's extra clear, APC 3.1.13 is a beta release. 3.1.14
was released and un-released because of memory leak issues.

If you're still using PHP 5.3 you might want to see if the issue is still
there in the latest *stable* APC

---

## #67438 — Peter Wang — 2013-05-17T07:49:28+00:00

URL: https://externals.io/message/67431#67438 · In reply to: #67437

Hi,

Thanks for your information.
I also tested the latest stable version of APC
(3.1.9<http://pecl.php.net/package/APC/3.1.9>),
which has the same problem.






> > […]
> APC
> > […]
>
> Just to make sure it's extra clear, APC 3.1.13 is a beta release. 3.1.14
> was released and un-released because of memory leak issues.
>
> If you're still using PHP 5.3 you might want to see if the issue is still
> there in the latest *stable* APC

---

## #67439 — Peter Wang — 2013-05-17T07:50:27+00:00

URL: https://externals.io/message/67431#67439 · In reply to: #67434

More information about this bug:

To stably re-produce the bug, we need create 2 files.
// file1.php, can be empty

// leak.php
<?php

while (true) {
    $file = 'file1.php';
    require($file);
}

then run: php -d apc.enable_cli=1 leak.php

hope this helps, thanks.





> Hi,
>
> I found that the memory leak is actually related to APC,
> even with the latest version of PHP (5.3.25) and latest version of APC
> (3.1.13),
> the memory leak is still there, to re-produce the bug,
> just run this script and watch the memory usage of the php process
> (please run with: php -d apc.enable_cli=1 )
>
> <?php
>
> touch('file1.php');
> while (true) {
>     $file = 'file1.php';
>     require($file);
> }
>
> if run with  -dapc.enable_cli=0, it does not leak memory.
>
> thanks.
>
>
> On Thu, May 16, 2013 at 11:40 AM, Stas Malyshev <smalyshev@sugarcrm.com>wrote:
>
> > […]
