If the exception is not handled in your code thedefault exception handler is called (which just printsa stack trace) and the stack is unwound and te programexits. Therefore, there is no need for garbagecollection.