php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #33711 unset() doesn't destroy object with internal references
Submitted: 2005-07-15 16:50 UTC Modified: 2005-07-15 21:57 UTC
From: mike dot hall at twistdigital dot co dot uk Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 5.1.0b2 OS: FreeBSD
Private report: No CVE-ID: None
 [2005-07-15 16:50 UTC] mike dot hall at twistdigital dot co dot uk
Description:
------------
PHP doesn't unset an object if it contains variables that include references to itself. Despite being unset, the objects remain in memory until the end of the request. This can lead to scripts consuming large amounts of memory when larger and more complex objects are being employed.

Reproduce code:
---------------
http://www.indelible.org.uk/reproduce.php

Expected result:
----------------
0
Create A
Create B
Destroying B
Destroying A
1
Create A
Create B
Destroying B
Destroying A
2
Create A
Create B
Destroying B
Destroying A
End of Loop

Actual result:
--------------
0
Create A
Create B
1
Create A
Create B
2
Create A
Create B
End of Loop
Destroying A
Destroying B
Destroying A
Destroying B
Destroying A
Destroying B

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-07-15 21:57 UTC] helly@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 15:01:29 2024 UTC