Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-08-01 Thread coder dumca
@ vaibhav   when we  are sure that we  dont need a particular object we can
call gc

On Mon, Aug 1, 2011 at 1:46 AM, Deepthi Srinivasan deeps1...@gmail.comwrote:

 Garbage collector'll never run according to our whims and fancies :P It'll
 run only when it wants (mostly when it senses that memory is going down). We
 can issue a request using system.gc but we cannot MAKE it run...


 On Sun, Jul 31, 2011 at 11:56 PM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 @mr coder : y do we need to call garbage collector explicitly when it
 works automatically ?


 On Sun, Jul 31, 2011 at 11:07 PM, coder dumca coder.du...@gmail.comwrote:

 generally jvm runs on following occasions

 1: periodicaliy
 2: when program is about to run out of memory the  JVM runs  and
 finallize the objects.
 3: when we call using System.gc  or Runtime.getruntime.gc

 pls correct me if i m wrong

 On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla 
 vaibhav200...@gmail.com wrote:

 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?

 --
   best wishes!!
 Vaibhav


 --
 You received this message because you are subscribed to the Google
 Groups Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
   best wishes!!
 Vaibhav
   MCA


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




 --
 Regards,
 Deepthi

  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread Deepthi Srinivasan
Garbage collection is totally JVM dependent... Some JVMs may use a mark and
sweep algorithm.
The first thing u should understand abt Java's garbage collection is totally
unpredicatble. You cant really predict when garbage collection is done. If
and when the JVM decides that garbage coll should be run, it checks all
objects, and those objects which have no references to it will be deleted
from the heap memory.
System.gc() makes a request to the JVM to run the garbage collection
mechanism. But its a bad practice to call it, because you cant really be
sure that JVM will not choose to ignore it. Moreover you can safely ignore
it cos the JVM, most probably is smarter than you, and knows when to run the
garbage collection mechanism on its own...

On Sat, Jul 30, 2011 at 11:40 PM, vaibhav shukla vaibhav200...@gmail.comwrote:

 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?

 --
   best wishes!!
 Vaibhav


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards,
Deepthi

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread siddharth srivastava
Hi Vaibhav

On 30 July 2011 23:40, vaibhav shukla vaibhav200...@gmail.com wrote:

 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?


 Please do not use ALL CAPS in subject line. It is a bit scary :)


 --
   best wishes!!
 Vaibhav


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
Regards
Siddharth Srivastava

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread coder dumca
generally jvm runs on following occasions

1: periodicaliy
2: when program is about to run out of memory the  JVM runs  and finallize
the objects.
3: when we call using System.gc  or Runtime.getruntime.gc

pls correct me if i m wrong

On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla vaibhav200...@gmail.comwrote:

 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?

 --
   best wishes!!
 Vaibhav


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-31 Thread vaibhav shukla
@mr coder : y do we need to call garbage collector explicitly when it works
automatically ?

On Sun, Jul 31, 2011 at 11:07 PM, coder dumca coder.du...@gmail.com wrote:

 generally jvm runs on following occasions

 1: periodicaliy
 2: when program is about to run out of memory the  JVM runs  and finallize
 the objects.
 3: when we call using System.gc  or Runtime.getruntime.gc

 pls correct me if i m wrong

 On Sat, Jul 30, 2011 at 11:10 AM, vaibhav shukla 
 vaibhav200...@gmail.comwrote:

 please give a glimps of how garbage collection is done in java.
 how *System.gc()*  works ?

 --
   best wishes!!
 Vaibhav


 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


  --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
  best wishes!!
Vaibhav
  MCA

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[algogeeks] HOW GARBAGE COLLECTOR WORKS IN JAVA

2011-07-30 Thread vaibhav shukla
please give a glimps of how garbage collection is done in java.
how *System.gc()*  works ?

-- 
  best wishes!!
Vaibhav

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.