Win a copy of Practice Tests for OCP Java 17 Certification Exam (1Z0-829) this week in the OCPJP forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

Can any one explain Garbage Collection

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one explain Garbage Collection in detail.
 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi tejas,
im sure u kno a bit bout garbage collection and gc. but if u want it in detail refer 2 Peter van der linden,s just java pg 295-98 u might get what u want. then u might ask clarify ur doubts. byeee.
 
Ranch Hand
Posts: 104
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tejas
check this out http://members.home.net/jgriscti/gc/behaviour.html
This will give a brief grasp on Garbage Collectior.
Cheers
Siva Prasad
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Teja
Garbage Collection is the responsibility of JVM. It uses algorithms. Garbage collection is only about memory. You dont know when JVM performs garbage collection whenever processor is free garbage is performed.
example is.
public class ABC
{

public static void prt(String s)
{
System.out.println(s);
}


ABC()
{
this.prt("using this"); //it display 2nd
}

public static void main(String[] args)
{
prt("hello 2"); //first this display

ABC a=new ABC(); //constructor call

ABC b=new ABC();

ABC c=new ABC();

ABC d=new ABC();

System.gc();

System.runFinalization();

}

}
finalize is also used for observing the process of garbage collection. you should never call finalize().
moreover www.bruceeckel.com study chapter 04

------------------
 
reply
    Bookmark Topic Watch Topic
  • New Topic