note 98692 added to function.unset
| From: | alex at bartl dot net | Date: | Thu, 01 Jul 2010 05:11:09 +0000 |
| Subject: | note 98692 added to function.unset | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170613@lists.php.net to get a copy of this message | ||
unset($class_object) does not release resources allocated by the object. If used in loops, which
create and destroy objects, that might easily lead to a resource problem. Explicitly call the
destructor to circumvent the problem.
//this causes a resource problem
for($f=0;$f<10000;$f++){
$my_class_object=new my_class_name();
unset($my_class_object);
}
//this releases the resources allocate by the object
for($f=0;$f<10000;$f++){
$my_class_object=new my_class_name();
$my_class_object->__destruct();
unset($my_class_object);
}
----
Server IP: 212.69.189.114
Probable Submitter: 90.146.133.211
----
Manual Page -- http://www.php.net/manual/en/function.unset.php
Edit -- https://master.php.net/note/edit/98692
Del: integrated -- https://master.php.net/note/delete/98692/integrated
Del: useless -- https://master.php.net/note/delete/98692/useless
Del: bad code -- https://master.php.net/note/delete/98692/bad+code
Del: spam -- https://master.php.net/note/delete/98692/spam
Del: non-english -- https://master.php.net/note/delete/98692/non-english
Del: in docs -- https://master.php.net/note/delete/98692/in+docs
Del: other reasons-- https://master.php.net/note/delete/98692
Reject -- https://master.php.net/note/reject/98692
Search -- https://master.php.net/manage/user-notes.php