Correct procedures to dispose a JDialog Object

T

terry

What is the correct procedures to dispose a JDialog Object for Garbage
collection?

Let's say d is a JDialog Object Do I need to do all of the following 2
instructions or just one of them?

d.dispose;//first
d=null;//second

Thanks!
 
V

VisionSet

terry said:
What is the correct procedures to dispose a JDialog Object for Garbage
collection?

Let's say d is a JDialog Object Do I need to do all of the following 2
instructions or just one of them?

d.dispose;//first
d=null;//second

Same goes for any object, set the reference to null, and it will be GC'd as
long as there aren't other reachable references to the same object.

however GC can not be guaranteed, it will happen sometime, usually soon.

So dispose cleans out all the graphical resources immediately.

So you should do both. But to answer your question, just the second.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top