php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #48369 Memory leak in array & objects
Submitted: 2009-05-23 17:27 UTC Modified: 2009-05-23 17:34 UTC
From: busia at tiscali dot it Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.3.0RC2 OS: Windows
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: busia at tiscali dot it
New email:
PHP Version: OS:

 

 [2009-05-23 17:27 UTC] busia at tiscali dot it
Description:
------------
When I unset an array containing object, the memory is not freed as expected. Too much memory is still used.

Reproduce code:
---------------
<?
ini_set('memory_limit','300M');
class a {
}

echo memory_get_usage()."\n";
$a=array();
for ($i=0; $i<=1000000; $i++) {
	$a[]= new a();
}
echo memory_get_usage()."\n";
unset($a);
echo memory_get_usage()."\n";
?>

Expected result:
----------------
325776
230042304
circa 325776

Actual result:
--------------
325776
230042304
33977912

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-05-23 17:34 UTC] jani@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 29 02:00:03 2025 UTC