Re: [PHP-DEV] Leak Script
At 10:03 AM 1/14/2004 -0500, Sterling Hughes wrote: > Looks like a circular reference to me. It's supposed to leak :) > Yep - but shouldn't object destruction be forced before the memory manager cleans it up. The example could rather be put as: function __construct() { $this->value = new GenericObject($this); } function __destruct() { print "Called\n"; } } class GenericObject { public $internal; function __construct($instance) { $this->internal = $instance; } } $o = new InstanceContainer(); ?> As you can predict, __destruct() won't be called. Shouldn't objects be unmercifully cleaned up before we rely on the memory manager to burn the leftovers? Not really. The reason is that say the two object's destructors depend on each other then you're going to be in a mess. There's no way of executing that in the right order. We are discussing with Marcus a patch he wrote which will basically warn you that this has happened so that you can fix your code. The patch isn't in the engine yet because I want to find a nicer way of implementing it. Andi -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Leak Script
> Looks like a circular reference to me. It's supposed to leak :) > Yep - but shouldn't object destruction be forced before the memory manager cleans it up. The example could rather be put as: value = new GenericObject($this); } function __destruct() { print "Called\n"; } } class GenericObject { public $internal; function __construct($instance) { $this->internal = $instance; } } $o = new InstanceContainer(); ?> As you can predict, __destruct() won't be called. Shouldn't objects be unmercifully cleaned up before we rely on the memory manager to burn the leftovers? -Sterling > Andi > > At 06:42 PM 1/13/2004 -0500, Sterling Hughes wrote: > >Hey, > > > >The attached script gives 10 leaks when PHP5 is compiled with > >--enable-debug. These problems are also related to Bug #26765, I'll be > >taking a look at it, unless someone knows the cause already. > > > >The leaks caused when running it are: > > > >/home/sterling/work/php/php-src/Zend/zend_execute.c(2840) : Freeing > >0x40162A30 (16 bytes), script=t.php > >/home/sterling/work/php/php-src/Zend/zend_hash.c(236) : Freeing > >0x401629CC (44 bytes), script=t.php > >Last leak repeated 1 time > >/home/sterling/work/php/php-src/Zend/zend_execute.c(3094) : Freeing > >0x40162968 (44 bytes), script=t.php > >/home/sterling/work/php/php-src/Zend/zend_API.c(720) : Actual location > >(location was relayed) > >Last leak repeated 1 time > >/home/sterling/work/php/php-src/Zend/zend_objects.c(88) : Freeing > >0x40162924 (12 bytes), script=t.php > >Last leak repeated 1 time > >/home/sterling/work/php/php-src/Zend/zend_execute.c(3093) : Freeing > >0x401628E0 (16 bytes), script=t.php > >/home/sterling/work/php/php-src/Zend/zend_API.c(721) : Freeing > >0x4016272C (32 bytes), script=t.php > >/home/sterling/work/php/php-src/Zend/zend_hash.c(157) : Actual location > >(location was relayed) > >Last leak repeated 1 time > >=== Total 10 memory leaks detected === > > > >-Sterling > > > >-- > >PHP Internals - PHP Runtime Development Mailing List > >To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Leak Script
Andi Gutmans ([EMAIL PROTECTED]) schrieb: > > These are not *real* memory leaks because they are cleaned up at the end of > the request. > Hi Andy, thanks a lot for making this clear. Thats why I told that I'm not sure if I understand this right ;-). Thomas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Leak Script
At 10:29 AM 1/14/2004 +0100, Thomas Seifert wrote: Andi Gutmans wrote: Looks like a circular reference to me. It's supposed to leak :) Andi Hi Andy, not sure if I understood this right but thats supposed to be that way? Anyone CAN create memory-leaks in php if he just wants? I'm not sure if hosters will like that behaviour with their apache processes (with mod_php) taking up more and more memory ;-). Thomas, These are not *real* memory leaks because they are cleaned up at the end of the request. Andi -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Leak Script
Andi Gutmans wrote: Looks like a circular reference to me. It's supposed to leak :) Andi Hi Andy, not sure if I understood this right but thats supposed to be that way? Anyone CAN create memory-leaks in php if he just wants? I'm not sure if hosters will like that behaviour with their apache processes (with mod_php) taking up more and more memory ;-). thomas -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] Leak Script
Looks like a circular reference to me. It's supposed to leak :) Andi At 06:42 PM 1/13/2004 -0500, Sterling Hughes wrote: Hey, The attached script gives 10 leaks when PHP5 is compiled with --enable-debug. These problems are also related to Bug #26765, I'll be taking a look at it, unless someone knows the cause already. The leaks caused when running it are: /home/sterling/work/php/php-src/Zend/zend_execute.c(2840) : Freeing 0x40162A30 (16 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_hash.c(236) : Freeing 0x401629CC (44 bytes), script=t.php Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_execute.c(3094) : Freeing 0x40162968 (44 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_API.c(720) : Actual location (location was relayed) Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_objects.c(88) : Freeing 0x40162924 (12 bytes), script=t.php Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_execute.c(3093) : Freeing 0x401628E0 (16 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_API.c(721) : Freeing 0x4016272C (32 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_hash.c(157) : Actual location (location was relayed) Last leak repeated 1 time === Total 10 memory leaks detected === -Sterling -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Leak Script
Hey, The attached script gives 10 leaks when PHP5 is compiled with --enable-debug. These problems are also related to Bug #26765, I'll be taking a look at it, unless someone knows the cause already. The leaks caused when running it are: /home/sterling/work/php/php-src/Zend/zend_execute.c(2840) : Freeing 0x40162A30 (16 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_hash.c(236) : Freeing 0x401629CC (44 bytes), script=t.php Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_execute.c(3094) : Freeing 0x40162968 (44 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_API.c(720) : Actual location (location was relayed) Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_objects.c(88) : Freeing 0x40162924 (12 bytes), script=t.php Last leak repeated 1 time /home/sterling/work/php/php-src/Zend/zend_execute.c(3093) : Freeing 0x401628E0 (16 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_API.c(721) : Freeing 0x4016272C (32 bytes), script=t.php /home/sterling/work/php/php-src/Zend/zend_hash.c(157) : Actual location (location was relayed) Last leak repeated 1 time === Total 10 memory leaks detected === -Sterling t.php Description: application/httpd-php -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php