Home > Back-end > The GC to reclaim really tagged objects at least twice
The GC to reclaim really tagged objects at least twice
Time:09-22
"to announce a tag object death will experience at least two processes: if by accessibility analysis without reference chain connected to GC Roots, is the first time tag and a filter, filter condition is whether the object has to perform the finalize () method, when the object does not cover the finalize () method, or finalize () method has been called virtual machine, virtual machine will both as" there is no need to perform, " If an object is necessary to perform the finalize () method, which will be placed in the F - Queue Queue, and later set up a virtual machine, the lower priority thread finalizers to execute it, virtual chance to trigger this approach, but don't wait for it to perform, or if an object in the finalize () method is performed in a slow, memory recovery system would collapse, finalize () method is an object finally a chance to escape death, GC will later F - the object in the Queue for the second small tag, if the object before the second marker could not save themselves will be recycled, saving way is as long as the associated with any object reference chain, " The above content from the books, if according to the above, then when the object's finalize () method is not necessary to perform, it is not only marked a can?
CodePudding user response:
Twice in the second is to do some confirmation, to prevent the recycling, and cited the etc
CodePudding user response:
To handsome but not to say that the second choice is the small sign? And is in users do not have to rewrite the finalize () method or didn't call the finalize () method of the object will do the second tag,,,,,,, still a little don't understand
CodePudding user response:
The original poster to read, is a finalize () object and not perform finalize () method will be in the F - and the second tag in the Queue, for which no finalize () method or has been performed this method still need to be recycled mark only one can be recycled,
CodePudding user response:
I read about, is to feel the contradiction of the book, he said the first sentence: GC objects at least twice before, and I'm from it in the words of the following, feel is a well, and it is as same as what you said, but the notes on the net also said at least twice, contradiction
CodePudding user response:
The the words together in front of the landlord to see admire, " even in accessibility analysis algorithm, unreachable object, also is not "the death", at that time they temporarily in the stage of "probation" , to truly an object declared dead ", people is the precondition of the suspended object to undergo two tag,
CodePudding user response:
In Java, every object has a unique "count", is used to mark the referenced number: if the add a variable reference, or minus one. If 0 indicates that the variables to be GC recycling