From:             bugs dot php dot net at ss dot chernousov dot net
Operating system: Any
PHP version:      5.5.1
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Memleak:Circular references on callbacks can't be resolved by 
Garbage Collector

Description:
------------
GC fails to resolve the circular reference if object A retains a reference
to a 
callback in object B and object B retains a reference to object A. Both
objects 
leak.

Native PHP stuff like SPL iterators with callbacks and Stream callbacks are
also 
vulnerable to this problem.

This does not apply to userland PHP objects (i.e. objects of classes that
were 
defined in PHP scripts by a user).

I provided a test script with a number of tests, including SPL iterators
with 
callbacks, Stream callbacks, as well as 3rd-party extensions like
pecl-event, 
pecl-ev, pecl-libevent, pecl-eio.

Test script:
---------------
https://gist.github.com/5lava/53aa2e53c7f8c658f045

Expected result:
----------------
==== NULL ====
==== GC ====
Obj::__destruct
==== THE END ====

or

==== NULL ====
Obj::__destruct
==== GC ====
==== THE END ====


Actual result:
--------------
==== NULL ====
==== GC ====
==== THE END ====
Obj::__destruct


-- 
Edit bug report at https://bugs.php.net/bug.php?id=65387&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65387&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65387&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65387&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65387&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65387&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65387&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65387&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65387&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65387&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65387&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65387&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65387&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65387&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65387&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65387&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65387&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65387&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65387&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65387&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65387&r=mysqlcfg

Reply via email to