[UPHPU] Freeing database resources
thebigdog
bigdog at venticon.com
Wed Jun 4 10:20:21 MDT 2008
> 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
More information about the UPHPU
mailing list