Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Mark and Sweep

 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On what concept garbage collector works ?
What is the concept of memory sweep?




please ranchers explain this concept in brief


Thanks in advance
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is not specified how GC works. You can not be sure about that. You can read somewhere that it uses for example mark&sweep algorithm but it is not obligatory.
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well from java5.0, automatic garbage collection has taken effect so the garbage collection is under the control of the JVM. Well i guess the memory sweeping concept is out of question now.
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So what was before Java 5?
 
Nitish Bangera
Ranch Hand
Posts: 537
Eclipse IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Before that java5, garbage collection could be done manually i suppose but it wasn't automatic. Well some info on the history of garbage collection could be found here .
 
Lucas Smith
Ranch Hand
Posts: 808
1
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for interesting link.
 
Dinesh Tahiliani
Ranch Hand
Posts: 486
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In simple what does mark does and sweep does?
Please answer .
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Pie
Posts: 15441
41
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nitish Bangera wrote:Before that java5, garbage collection could be done manually i suppose but it wasn't automatic.

Garbage collection has always been automatic in Java, it has never been the case that you had to call the garbage collector explicitly to do garbage collection, not even in Java 1.0.

It's interesting to know how garbage collection (note the link) works, but you do not need to know such internal implementation details of the JVM for the SCJP exam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic