Results 1 to 5 of 5

Thread: question about garbage collection...

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    question about garbage collection...

    how do you explicitly "DESTROY" objects in java? I know about the garbage collection doing it on its own but i'm looking for something more like in vb.net, such as:

    myObject = nothing

  2. #2
    Fanatic Member sql_lall's Avatar
    Join Date
    Jul 2002
    Location
    Up Above (i.e. AUS)
    Posts
    571

    Re: question about garbage collection...

    Best I can think of is using the null keyword:
    myObject = null;
    sql_lall

  3. #3
    Frenzied Member System_Error's Avatar
    Join Date
    Apr 2004
    Posts
    1,111

    Re: question about garbage collection...

    You don't.. It's automatic and happens periodically. You can set them to null like sqlall said, to maybe prevent errors or already have the object initialized for further use.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: question about garbage collection...

    thanks.

  5. #5
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418

    Re: question about garbage collection...

    Yeah just dangle the ref and the garbage collector should reclaim the allocated memory.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width