Monday, January 16, 2012

Tell Something about class/object life cycle...





  1. Load the assembly
  2. Execute static initialisers
  3. "new" call:
    • allocate memory
    • execute non-static initialisers
    • execute constructor
  4. the instance is now ready to be used
  5. after the last reference to the object has vanished: if the object has no finalizer, it is now ready for collection; if the object has a finalizer, it is put on the finalizer queue.
  6. (optional) the objects from the finalizer queue have their finalizer called in a special thread; if there is still no reference from the application to the object, it too becomes now eligible for garbage collection
  7. the garbage collector deallocates memory



No comments:

Post a Comment

Live

Your Ad Here