If a program relies on finalize()
to release system resources, or if there is confusion over which part of the program is responsible for releasing system resources, then there exists a possibility of a potential resource leak. In a busy system, there might be a time gap before the finalize()
method is called for an object. An attacker might exploit this vulnerability to induce a denial-of-service attack. The guideline OBJ02OBJ08-J. Avoid using finalizers has more information on the demerits of using finalizers.
...