Re: Closing Objects "Cleaning Up"

From: Date: Thu, 01 Feb 2001 23:23:35 +0000
Subject: Re: Closing Objects "Cleaning Up"
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-37751@lists.php.net to get a copy of this message
True for PHP+Mysql, but not for all databases. Oracle for example, will run out of cursors in a week or two on a low-traffic site if you don't close them and the db server will need a kick in the nuts to get back up Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. ----- Original Message ----- From: "David Robley" <huntsman@hermes.nisu.flinders.edu.au> To: "Karl J. Stubsjoen" <karlflips@kstub.com>; "PHP Mailing List" <php-general@lists.php.net> Sent: Friday, February 02, 2001 10:19 AM Subject: Re: [PHP] Closing Objects "Cleaning Up" > On Fri, 2 Feb 2001 08:58, Karl J. Stubsjoen wrote: > > When I do this: > > $link = @mysql_pconnect("localhost", $this->db_user_id, > > $this->db_passwd); > > > > And I do this: > > if(!($result = mysql_query($querystr))) { ... > > > > Then I do this: > > $result = DoQuery($q); > > > > > > What objects are there to close? In ASP we issue code like this to close > > these objects: > > rs.close > > set rs = nothing > > db.close > > set db = nothing > > (where rs is the recordset and db is the database) > > > > Thank You! > > You don't need to do anything - when the script terminates all that sort of > thing is done for you by PHP. However, if you have a result set that may be > using a bit of memory, and you have a lot more script after the result set > is done with, you can use mysql_free_result. From TFM: > > > mysql_free_result - Free result memory > > Description > > int mysql_free_result (int result) > > mysql_free_result() will free all memory associated with the > result identifier result. > > mysql_free_result() only needs to be called if you are concerned about how > much memory is being used for queries that return large result sets. All > associated result memory is automatically freed at the end of the script's > execution. > > For downward compatibility mysql_freeresult() can also be used. > > Cheers > -- > David Robley | WEBMASTER & Mail List Admin > RESEARCH CENTRE FOR INJURY STUDIES | > http://www.nisu.flinders.edu.au/ > AusEinet | > http://auseinet.flinders.edu.au/ > Flinders University, ADELAIDE, SOUTH AUSTRALIA > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#37751) next »