garbage collection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suresh pandey
    New Member
    • Mar 2010
    • 4

    garbage collection

    suppose we have written a programme and we have created an object.now after that we written another programme then will it the memory occupied by the object of previous programme cleared.
  • jkmyoung
    Recognized Expert Top Contributor
    • Mar 2006
    • 2057

    #2
    It's possible. Are you talking about memory in RAM, or memory on disk?
    Do you mean run a program as opposed to have written a program?

    ... Did you close the window, or open a new project without saving your initial code?

    Comment

    • suresh pandey
      New Member
      • Mar 2010
      • 4

      #3
      i dont know which memory is allocated during the creation of object.actually i am not getting the meaning of garbage collection properly.

      Comment

      • anurag275125
        New Member
        • Aug 2009
        • 79

        #4
        Memory is allocated for an object with the new operator. And now question is, how this memory is deallocated? Unlike C\C++ where memory is deallocated using the delete operator. java handles memory deallocation by an automatic called, Garbage Collection.

        when no reference to an object exists , then that object is considered to be no longer required, and hence becomes a suitable candidate for garbage collection.

        Garbage collection is an automatic process executed by the JVM which deallocates the memory occupied by the objects that are no longer referenced by any variable.

        Comment

        Working...