Tag Archives: garbage collection

garbage collection

With PHP, you do not need to
worry about reclaiming memory that is reserved for your variables or
objects. Although you can manually remove a variable or object with
the unset() function, there is usually no reason to do so—as with
variables, PHP will automatically clean up unused memory when
an object within a function goes out of scope, or at the end of the
script for global objects. Th e one exception involves open database
connections.because database connections
can take up a lot of memory, you should explicitly close a
database connection when you fi nish with it by calling the procedural
mysql_close() function or the close() method of the mysqli class.