I've seen problems when using persistent connections to MySQL.  The garbage 
collector seems to ignore those and you sometimes have to kill the processes 
manually if you don't close the connection in your script.  But for 
non-persistent connections I've never had problems by not explicitly closing 
the connection.

-wes


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of thebigdog
Sent: Wednesday, June 04, 2008 10:20 AM
To: Rusty Keele
Cc: UPHPU
Subject: Re: [UPHPU] Freeing database resources

> I very rarely free up my resources when using PHP to interact with a MySQL
> database.  I figure that the garbage collector will do an adequate job.  In
> fact the PHP manual says: "Thanks to the reference-counting system introduced
> with PHP 4's Zend Engine, a resource with no more references to it is
> detected automatically, and it is freed by the garbage collector."
> 
> However, I notice that in the same PHP manual they always free up their
> resources in the examples they give!  Why do they do that if the resources
> are garbage collected?  Perhaps they are just being careful coders and
> demonstrating best practices.  Anyway, I am wondering if anybody has ever had
> problems by NOT freeing up MySQL resources - you know, by not calling
> mysql_close() or mysql_free_result().
> 
> Also, I mostly use the MySQL Improved Extension (mysqli_x) functions and
> methods, and I assume they work the same way by automatically garbage
> collecting unfreed resources, but I'm not 100% sure.  Does anybody know?

I always free up resources. just because the engine can do it doesn't mean that 
their might be issue or problems that arise. I have always been in the habit of 
cleaning up after i do things cause you never know when their might be issues 
with resources.

--
thebigdog

_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net



_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to