Results 1 to 2 of 2
  1. #1
    fatabass is offline Senior Member
    Join Date
    Nov 2011
    Location
    Turkey
    Posts
    380
    Blog Entries
    24
    Rep Power
    3

    Default How to know when an object has been garbage collected ?

    Hi,

    I have a class called SomeClass and I use objects of this class in my application.

    I would like to know when these objects are garbage collected. A simple line in Console is fine. Any easy way to do this ?

  2. #2
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,532
    Blog Entries
    7
    Rep Power
    20

    Default Re: How to know when an object has been garbage collected ?

    Add a finalizer() method; it is called just before the object is garbage collected.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 5
    Last Post: 07-06-2011, 04:24 AM
  2. How can I protect a Variable to be Garbage Collected
    By msv1022 in forum Advanced Java
    Replies: 7
    Last Post: 05-16-2011, 12:10 PM
  3. When does the Garbage Collector pick up an object?
    By nolsen01 in forum New To Java
    Replies: 5
    Last Post: 02-27-2010, 03:32 PM
  4. Q about Garbage Collector
    By m00nchile in forum New To Java
    Replies: 4
    Last Post: 02-05-2010, 05:57 AM
  5. How setting an Object to null help Garbage Collection?
    By piyu.sha in forum Advanced Java
    Replies: 3
    Last Post: 10-06-2008, 07:35 AM

Posting Permissions

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