#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: web_Fell at hotmail dot com Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: We should close this as dupe of bug #33595: http://bugs.php.net/bug.php?id=33595 Previous Comments: [2009-04-02 23:32:46] medge at neverathome dot net This problem still exists - this is causing us extreme headaches as we will need to have two object models in our system. One which is useful, and one which is "in case we have to do anything with high load in PHP" and isn't an object model at all. This seems like a pretty critical bug. [2009-04-01 13:45:54] phpuser at gmail dot com Having the same issue with php 5.2.9. As stated above, this is a major problem, as I'm using php to import/export data between databases, and I'm talking about millions rows. I have to split the data to import, because even after using unset() the memory used by objects isn't released. Please do something about this bug. It has been reported 6 years ago and is still here !! Tested with php 5.2.6 and 5.2.9, both with linux and windows xp. [2007-03-01 03:51:12] matthieu dot aubry at gmail dot com I also have the same problem using PHP Version => 5.1.2 Build Date => Nov 2 2006 12:28:13 Server API => Command Line Interface This bug is really annoying. I'm working on a project which loads thousands of files parsed into objects. I use the technic $this->myObjectMember->register($this); which creates cross references. Calling unset() doesn't change anything, as seen in the examples provided above. I would love to see this bug fixed! Thank you. [2005-06-17 16:25:54] apinstein at mac dot com I have experienced this problem on PHP5 as well... here's a test script: echo memory_get_usage() . " (initial)\n"; $t = new test; echo memory_get_usage() . " (after: \$t = new test();)\n"; unset($t); echo memory_get_usage() . " (after: unset(\$t);)\n"; echo "done\n"; class test { protected $str; protected $t2; function __construct() { print "construct test\n"; $this->str = str_repeat('1234567890', 1000); $this->t2 = new test2($this); } function __destruct() { print "destruct test\n"; } } class test2 { protected $str; protected $t1; function __construct($t1) { print "construct test2\n"; $this->str = str_repeat('1234567890', 1000); $this->t1 = $t1; } function __destruct() { print "destruct test2\n"; unset($this->str); } } And the output of this script: 51416 (initial) construct test construct test2 72000 (after: $t = new test();) 72000 (after: unset($t);) done destruct test destruct test2 It's definitely a real problem. Simply removing the cross- referenced instance vars will remove the problem. However, as you can see, even explicitly calling unset() still doesn't release the objects or call destructors until the script EXITS. This is a *MAJOR* problem for anyone using OO to process large amounts of information. [2004-03-01 05:07:55] tom at scl dot co dot uk Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: medge at neverathome dot net Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: This problem still exists - this is causing us extreme headaches as we will need to have two object models in our system. One which is useful, and one which is "in case we have to do anything with high load in PHP" and isn't an object model at all. This seems like a pretty critical bug. Previous Comments: [2009-04-01 13:45:54] phpuser at gmail dot com Having the same issue with php 5.2.9. As stated above, this is a major problem, as I'm using php to import/export data between databases, and I'm talking about millions rows. I have to split the data to import, because even after using unset() the memory used by objects isn't released. Please do something about this bug. It has been reported 6 years ago and is still here !! Tested with php 5.2.6 and 5.2.9, both with linux and windows xp. [2007-03-01 03:51:12] matthieu dot aubry at gmail dot com I also have the same problem using PHP Version => 5.1.2 Build Date => Nov 2 2006 12:28:13 Server API => Command Line Interface This bug is really annoying. I'm working on a project which loads thousands of files parsed into objects. I use the technic $this->myObjectMember->register($this); which creates cross references. Calling unset() doesn't change anything, as seen in the examples provided above. I would love to see this bug fixed! Thank you. [2005-06-17 16:25:54] apinstein at mac dot com I have experienced this problem on PHP5 as well... here's a test script: echo memory_get_usage() . " (initial)\n"; $t = new test; echo memory_get_usage() . " (after: \$t = new test();)\n"; unset($t); echo memory_get_usage() . " (after: unset(\$t);)\n"; echo "done\n"; class test { protected $str; protected $t2; function __construct() { print "construct test\n"; $this->str = str_repeat('1234567890', 1000); $this->t2 = new test2($this); } function __destruct() { print "destruct test\n"; } } class test2 { protected $str; protected $t1; function __construct($t1) { print "construct test2\n"; $this->str = str_repeat('1234567890', 1000); $this->t1 = $t1; } function __destruct() { print "destruct test2\n"; unset($this->str); } } And the output of this script: 51416 (initial) construct test construct test2 72000 (after: $t = new test();) 72000 (after: unset($t);) done destruct test destruct test2 It's definitely a real problem. Simply removing the cross- referenced instance vars will remove the problem. However, as you can see, even explicitly calling unset() still doesn't release the objects or call destructors until the script EXITS. This is a *MAJOR* problem for anyone using OO to process large amounts of information. [2004-03-01 05:07:55] tom at scl dot co dot uk Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. [2004-02-23 11:21:41] tom at scl dot co dot uk I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: phpuser at gmail dot com Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: Having the same issue with php 5.2.9. As stated above, this is a major problem, as I'm using php to import/export data between databases, and I'm talking about millions rows. I have to split the data to import, because even after using unset() the memory used by objects isn't released. Please do something about this bug. It has been reported 6 years ago and is still here !! Tested with php 5.2.6 and 5.2.9, both with linux and windows xp. Previous Comments: [2007-03-01 03:51:12] matthieu dot aubry at gmail dot com I also have the same problem using PHP Version => 5.1.2 Build Date => Nov 2 2006 12:28:13 Server API => Command Line Interface This bug is really annoying. I'm working on a project which loads thousands of files parsed into objects. I use the technic $this->myObjectMember->register($this); which creates cross references. Calling unset() doesn't change anything, as seen in the examples provided above. I would love to see this bug fixed! Thank you. [2005-06-17 16:25:54] apinstein at mac dot com I have experienced this problem on PHP5 as well... here's a test script: echo memory_get_usage() . " (initial)\n"; $t = new test; echo memory_get_usage() . " (after: \$t = new test();)\n"; unset($t); echo memory_get_usage() . " (after: unset(\$t);)\n"; echo "done\n"; class test { protected $str; protected $t2; function __construct() { print "construct test\n"; $this->str = str_repeat('1234567890', 1000); $this->t2 = new test2($this); } function __destruct() { print "destruct test\n"; } } class test2 { protected $str; protected $t1; function __construct($t1) { print "construct test2\n"; $this->str = str_repeat('1234567890', 1000); $this->t1 = $t1; } function __destruct() { print "destruct test2\n"; unset($this->str); } } And the output of this script: 51416 (initial) construct test construct test2 72000 (after: $t = new test();) 72000 (after: unset($t);) done destruct test destruct test2 It's definitely a real problem. Simply removing the cross- referenced instance vars will remove the problem. However, as you can see, even explicitly calling unset() still doesn't release the objects or call destructors until the script EXITS. This is a *MAJOR* problem for anyone using OO to process large amounts of information. [2004-03-01 05:07:55] tom at scl dot co dot uk Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. [2004-02-23 11:21:41] tom at scl dot co dot uk I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> [2003-02-25 02:03:00] sni...@php.net No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: matthieu dot aubry at gmail dot com Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: I also have the same problem using PHP Version => 5.1.2 Build Date => Nov 2 2006 12:28:13 Server API => Command Line Interface This bug is really annoying. I'm working on a project which loads thousands of files parsed into objects. I use the technic $this->myObjectMember->register($this); which creates cross references. Calling unset() doesn't change anything, as seen in the examples provided above. I would love to see this bug fixed! Thank you. Previous Comments: [2005-06-17 16:25:54] apinstein at mac dot com I have experienced this problem on PHP5 as well... here's a test script: echo memory_get_usage() . " (initial)\n"; $t = new test; echo memory_get_usage() . " (after: \$t = new test();)\n"; unset($t); echo memory_get_usage() . " (after: unset(\$t);)\n"; echo "done\n"; class test { protected $str; protected $t2; function __construct() { print "construct test\n"; $this->str = str_repeat('1234567890', 1000); $this->t2 = new test2($this); } function __destruct() { print "destruct test\n"; } } class test2 { protected $str; protected $t1; function __construct($t1) { print "construct test2\n"; $this->str = str_repeat('1234567890', 1000); $this->t1 = $t1; } function __destruct() { print "destruct test2\n"; unset($this->str); } } And the output of this script: 51416 (initial) construct test construct test2 72000 (after: $t = new test();) 72000 (after: unset($t);) done destruct test destruct test2 It's definitely a real problem. Simply removing the cross- referenced instance vars will remove the problem. However, as you can see, even explicitly calling unset() still doesn't release the objects or call destructors until the script EXITS. This is a *MAJOR* problem for anyone using OO to process large amounts of information. [2004-03-01 05:07:55] tom at scl dot co dot uk Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. [2004-02-23 11:21:41] tom at scl dot co dot uk I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> [2003-02-25 02:03:00] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-02-17 04:51:30] [EMAIL PROTECTED] Test with the php5 snapshot please: http://snaps.php.net/php5-latest.tar.gz It won't be fixed in PHP 4 anyway as it has to do with the way objects work there. 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: apinstein at mac dot com Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: I have experienced this problem on PHP5 as well... here's a test script: echo memory_get_usage() . " (initial)\n"; $t = new test; echo memory_get_usage() . " (after: \$t = new test();)\n"; unset($t); echo memory_get_usage() . " (after: unset(\$t);)\n"; echo "done\n"; class test { protected $str; protected $t2; function __construct() { print "construct test\n"; $this->str = str_repeat('1234567890', 1000); $this->t2 = new test2($this); } function __destruct() { print "destruct test\n"; } } class test2 { protected $str; protected $t1; function __construct($t1) { print "construct test2\n"; $this->str = str_repeat('1234567890', 1000); $this->t1 = $t1; } function __destruct() { print "destruct test2\n"; unset($this->str); } } And the output of this script: 51416 (initial) construct test construct test2 72000 (after: $t = new test();) 72000 (after: unset($t);) done destruct test destruct test2 It's definitely a real problem. Simply removing the cross- referenced instance vars will remove the problem. However, as you can see, even explicitly calling unset() still doesn't release the objects or call destructors until the script EXITS. This is a *MAJOR* problem for anyone using OO to process large amounts of information. Previous Comments: [2004-03-01 05:07:55] tom at scl dot co dot uk Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. [2004-02-23 11:21:41] tom at scl dot co dot uk I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> [2003-02-25 02:03:00] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-02-17 04:51:30] [EMAIL PROTECTED] Test with the php5 snapshot please: http://snaps.php.net/php5-latest.tar.gz It won't be fixed in PHP 4 anyway as it has to do with the way objects work there. [2003-02-16 15:40:55] adey dot spam at bigfoot dot com I am experiencing this problem with Win2k/IIS 5.0. Memory usage increases until the server starts to page and crawl to a slow death. I have helped this somewhat by writing an app to unload the ISAPI every half an hour, but it is still causing problems about once a week (on a very busy site). Still preferable to using the CGI though 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: tom at scl dot co dot uk Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: Is anyone looking into this? I've found any method of releasing the objects fails, no just using the unset() function, if the object just go out of scope they aren't released, for ezample, if you do something like function MyFunc() { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; } Then after the function has finished then the memory allocated for the local variables $x and $y is not freed up. Previous Comments: [2004-02-23 11:21:41] tom at scl dot co dot uk I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> [2003-02-25 02:03:00] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-02-17 04:51:30] [EMAIL PROTECTED] Test with the php5 snapshot please: http://snaps.php.net/php5-latest.tar.gz It won't be fixed in PHP 4 anyway as it has to do with the way objects work there. [2003-02-16 15:40:55] adey dot spam at bigfoot dot com I am experiencing this problem with Win2k/IIS 5.0. Memory usage increases until the server starts to page and crawl to a slow death. I have helped this somewhat by writing an app to unload the ISAPI every half an hour, but it is still causing problems about once a week (on a very busy site). Still preferable to using the CGI though [2003-02-06 08:56:47] jparneodo at yahoo dot fr You are asking me to test PHP 5, but the bug is open for for PHP 4 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: tom at scl dot co dot uk Reported By: jparneodo at yahoo dot fr Status: No Feedback Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: I had this problem with PHP4.3.3. I then found this bug report and upgraded to PHP5.0.0b4 to try and fix this problem and I still get the memory leak problem, there is some demo code below, you need to change /path/to/large/file. I've been using a file which is about 1.5mb and when PHP is set to stop when it reaches 8mb then it only makes it through the loop twice. I'm 1.5 years into a project and I could really do with knowing if this is going to be fixed anytime soon so I can either wait for the fix or try and find a work around. Thanks for your time, Tom --- val = file('/path/to/large/file'); } } while (1) { $x = new C; $y = new C; $x->ref =& $y; $y->ref =& $x; unset($y); unset($x); echo "."; } ?> Previous Comments: [2003-02-25 02:03:00] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-02-17 04:51:30] [EMAIL PROTECTED] Test with the php5 snapshot please: http://snaps.php.net/php5-latest.tar.gz It won't be fixed in PHP 4 anyway as it has to do with the way objects work there. [2003-02-16 15:40:55] adey dot spam at bigfoot dot com I am experiencing this problem with Win2k/IIS 5.0. Memory usage increases until the server starts to page and crawl to a slow death. I have helped this somewhat by writing an app to unload the ISAPI every half an hour, but it is still causing problems about once a week (on a very busy site). Still preferable to using the CGI though [2003-02-06 08:56:47] jparneodo at yahoo dot fr You are asking me to test PHP 5, but the bug is open for for PHP 4 [2003-02-06 08:31:39] [EMAIL PROTECTED] You were supposed to test this snapshot: http://snaps.php.net/php5-latest.tar.gz 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1
#22055 [Com]: Memory leak with references in objects
ID: 22055 Comment by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Scripting Engine problem Operating System: RedHat 7.2 PHP Version: 4.3.1-dev New Comment: I am experiencing this problem with Win2k/IIS 5.0. Memory usage increases until the server starts to page and crawl to a slow death. I have helped this somewhat by writing an app to unload the ISAPI every half an hour, but it is still causing problems about once a week (on a very busy site). Still preferable to using the CGI though Previous Comments: [2003-02-06 08:56:47] [EMAIL PROTECTED] You are asking me to test PHP 5, but the bug is open for for PHP 4 [2003-02-06 08:31:39] [EMAIL PROTECTED] You were supposed to test this snapshot: http://snaps.php.net/php5-latest.tar.gz [2003-02-05 13:41:08] [EMAIL PROTECTED] Same result with PHP Version 4.3.1-dev php4-STABLE-200302051830.tar.gz Build Date Feb 5 2003 20:08:24 [2003-02-04 14:37:20] [EMAIL PROTECTED] oops! you need to development snapshot from snaps.php.net, which should solve this. Derick [2003-02-04 14:36:48] [EMAIL PROTECTED] Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip 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/22055 -- Edit this bug report at http://bugs.php.net/?id=22055&edit=1