|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47038 Memory leak in include()
Submitted: 2009-01-08 15:57 UTC Modified: 2013-05-16 09:36 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: tim at digicol dot de Assigned: scottmac (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5.3CVS, 6CVS (2009-01-20) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tim at digicol dot de
New email:
PHP Version: OS:


 [2009-01-08 15:57 UTC] tim at digicol dot de
With today's PHP 5.3 snapshot, include() on my Linux box leaks memory; 
I've noticed this because we're using long-running scripts with the 
PHP CLI (where Smarty's fetch/display methods call include()...). This 
doesn't happen with PHP 5.2.6.

I tested with an unchanged copy of php.ini-recommended and just 
'./configure' without any options, on Debian Linux 4.0, running in 
VMware Fusion on my Intel Mac.

Thanks for looking into this, and for the great work on PHP!

Reproduce code:

// Create an empty file

while (true)
    echo memory_get_usage() . "\n";


Expected result:
No increase in memory usage.

Actual result:
Memory usage increases constantly, until PHP exits because the memory 
limit is exceeded.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-20 11:11 UTC] tim at digicol dot de
Happens to me with PHP 6.0.0-dev (snapshot php6.0-200901200730.tar.bz2) 
as well.
 [2009-01-30 14:51 UTC] tim at digicol dot de
Sorry, I don't want to get on your nerves - just for the record, this 
still happens to me with PHP 5.3.0beta1.
 [2009-01-30 15:30 UTC]
The bug report is still marked as Assigned so obviously its not fixed...
 [2009-03-25 15:25 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

 [2013-05-16 09:18 UTC] ptr dot wang at gmail dot com
Why this was closed? It seems this bug is still there, at least in this 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
 [2013-05-16 09:36 UTC]
@ptr dot wang at gmail dot com

Please try the latest release.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Feb 21 13:01:28 2024 UTC