permaculture playing cards*
The moose likes Java in General and the fly likes finalize() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "finalize() method " Watch "finalize() method " New topic
Author

finalize() method

Devu Shah
Ranch Hand

Joined: Jun 21, 2001
Posts: 50
Hello,
I have one doubt.
I am using VERY BIG Help file in JEditorPane ( to show online help) as follow.
URL url = ClassLoader.getSystemResource(fileName);
pane = new JEditorPane(url);
..................
.................
Now what should I make null, in finalize method, to free up non java resource ?
should it be url ?
or pane ?
i.e. should it be url = null;
or pane = null; in finalize method.
thanks in advance.
Devu
Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

If url is a class member, you should set both to null. If it's a local reference that goes away on the completion of its enclosing method, it would seem like setting pane to null is sufficient.
There's no significant cost in dong both when you're not sure, though.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
 
 
subject: finalize() method
 
Similar Threads
JEditorPane problem
finalize() use
finalize() doubt
Help Menu
Browser component for on-line help