Correct procedures to dispose a JDialog Object

Discussion in 'Java' started by terry, Jun 4, 2004.

  1. terry

    terry Guest

    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!
     
    terry, Jun 4, 2004
    #1
    1. Advertising

  2. terry

    VisionSet Guest

    "terry" <> wrote in message
    news:...
    > 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.

    --
    Mike W
     
    VisionSet, Jun 4, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Antonio Concepcion
    Replies:
    3
    Views:
    2,736
    Antonio Concepcion
    Feb 17, 2005
  2. =?Utf-8?B?QXNoYQ==?=

    how to dispose and object nicely.

    =?Utf-8?B?QXNoYQ==?=, Mar 1, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    367
    Mark Fitzpatrick
    Mar 1, 2005
  3. joon
    Replies:
    1
    Views:
    516
    Roedy Green
    Jul 8, 2003
  4. Digital Puer
    Replies:
    6
    Views:
    6,016
    Thomas Weidenfeller
    May 13, 2004
  5. fabrice
    Replies:
    4
    Views:
    2,322
    fabrice
    Nov 15, 2006
Loading...

Share This Page