Zum Inhalt springen

Memory Leak Due to Time-Taking finalize() Method

All objects in Java implicitly inherit from java.lang.Object. This class contains multiple methods, which can be overridden in the child class. 

One such overridable method is finalize(). Before objects get garbage collected from memory, the JVM will execute the finalize(). So, if you need to close any resources that were opened in the class (like backend connections, Files…), it can be done in this method. 

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert