I suppose Java has ad-hoc "close" or "dispose" methods (albeit for resources rather than blocks of memory).Ugh. "delete" I hope! Do java and javscript even have a "free"?
For example if you open a resource, such as a file and later on in execution, an exception occurs and stack unwinds, if you later try to open that file again, you have no guarantee that the GC has closed it yet and you will get another (this time earlier) exception if you re-enter the same code path.
So the try/catch/finally stuff and ultimately "manual" memory management is needed. Thread cleanup is also a little less elegant than the RAII approach.
Microsoft's Java obviously has the
IDisposable
and using
cruft which is a bit useless for resources as members.