On Tue, Jun 3, 2008 at 4:12 PM, Rusty Keele <[EMAIL PROTECTED]> wrote: > 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().
I have always operated under the idea that freeing resources should be handled the same way as freeing any other in memory data structure. I don't bother deleting, undefining, freeing any variable or resource, unless it could possibly be large and I have need to do lots of other processing after it's use is done. Example: A database result set. If I use the result set, and my script completes very shortly after the result set is no longer needed to me I just let the garbage collector/end of script clean up for me. If I have a large array in memory, run my processing early and extract needed data out. I then move on to do some other heavy processing, but no longer need to access the large array, I delete the large array as soon as I am done. --lonnie _______________________________________________ UPHPU mailing list [email protected] http://uphpu.org/mailman/listinfo/uphpu IRC: #uphpu on irc.freenode.net
