Because garbage collection is not the same as cleaning up resources.
For example, if you have a JDBC connection object that is out of scope, there is no signal to the database server indicating that open cursors and connections are no longer needed. Without these messages, you end up running out of cursors and connections.
. .