#27992 [Bgs]: Resource Leak

From: Date: Thu, 15 Apr 2004 15:12:16 +0000
Subject: #27992 [Bgs]: Resource Leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-58202@lists.php.net to get a copy of this message
ID: 27992 Updated by: sean@php.net Reported By: sean@php.net Status: Bogus Bug Type: Class/Object related Operating System: Linux (any) PHP Version: 4.3.6RC3 New Comment: Ah, now that you point that out, it's clear. Thank you. This is why I posted to internals@, first. Agreed. Bogus. S Previous Comments: ------------------------------------------------------------------------ [2004-04-15 10:34:13] gschlossnagle@php.net Hi. This isn't a bug. In your constructor, you stick a reference to $this in $_PEAR_destructor_object_list. This gives the object a refcount of 2, so it isn't destructed when it falls out of scope. This is expected behavior here. ------------------------------------------------------------------------ [2004-04-15 10:15:26] sean@php.net Segfault: understandable My real concern is that it seems resources are not being released in this context. 65k is a big number (segfault). 1k not so much (warning; unable to open resource). S ------------------------------------------------------------------------ [2004-04-15 10:05:43] gschlossnagle@php.net The segfault is a known (and I believe wont-be-fixed-in -4) bug in the reference counting implementation. ------------------------------------------------------------------------ [2004-04-15 10:02:33] sean@php.net First, $sock should get re-allocated in each iteration, thereby forcing the former $sock (and it's ->fp) out of scope. Second, the connect() method for $sock checks to see if it already has an allocated $fp; and if so, does an fclose. While this example isn't practical, this problem directly affects PEAR's HTTP_Request code (but this still isn't a PEAR issue). S ------------------------------------------------------------------------ [2004-04-14 22:34:20] sniper@php.net Why woudln't it run out of file handles when you never CLOSE the socket..? ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/27992 -- Edit this bug report at http://bugs.php.net/?id=27992&edit=1

« previous php.bugs (#58202) next »