php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64859 memory leak in require/include when APC is enabled.
Submitted: 2013-05-16 12:02 UTC Modified: 2016-11-18 21:11 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: ptr dot wang at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.3.25 OS: Linux/MacOSX
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ptr dot wang at gmail dot com
New email:
PHP Version: OS:

 

 [2013-05-16 12:02 UTC] ptr dot wang at gmail dot com
Description:
------------
use the latest version of PHP (5.3.25) and latest version of APC (3.1.13),
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.


Test script:
---------------
<?php

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


Expected result:
----------------
The memory usage should not grow.

Actual result:
--------------
The memory usage grows very quickly.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-05-16 22:23 UTC] ptr dot wang at gmail dot com
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.
 [2016-11-18 21:11 UTC] kalle@php.net
-Status: Open +Status: Wont fix
 [2016-11-18 21:11 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 22 03:01:28 2024 UTC