aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Garbage collection Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Garbage collection" Watch "Garbage collection" New topic
Author

Garbage collection

sumedha rao
Ranch Hand

Joined: Nov 26, 2010
Posts: 115



scjp1.6,scwcd1.5!!!
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3097
    
  33

What is the question?

Also you cannot really force the JVM to do Garbage collection even if you use methods of Runtime class.

Update: or the System.gc()


Mohamed Sanaulla | My Blog
sumedha rao
Ranch Hand

Joined: Nov 26, 2010
Posts: 115

how many are available for garbage collection??
I think it is 0 to 9999 na???
am i right???
explanation:
# for(int i=0; i<10000; i++ ) {
# GC1 x = new GC1(i);
ie: GC x=new GC(0); //now GC(0) is available for garbage collection
GC x=new GC(1);// now GC(1) is available for garbage coolection
...........
ta rara rara...TILL the last one that is 10000
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3097
    
  33

I would say- All the objects created in the loop are eligible for GC once the loop completes the execution. Because the reference variables go out of scope and there's no valid reference to access these objects.
sumedha rao
Ranch Hand

Joined: Nov 26, 2010
Posts: 115

dats what i said...

thanks for the reply
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3097
    
  33

sumedha rao wrote:dats what i said...

thanks for the reply


Oh yeah. I was thinking that you told the instance created in the last iteration would not be.
sumedha rao
Ranch Hand

Joined: Nov 26, 2010
Posts: 115


dats what i said(AFTER EDITING )...

thanks for the reply
Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3097
    
  33

sumedha rao wrote:

dats what i said(AFTER EDITING )...

thanks for the reply


If you have edited the post, after someone read/replied to it- Please let others know what was the change. You can always write a remark at the end- Update/Edit: <What ever update>. That way other members who are reading the posts will not get confused.
sumedha rao
Ranch Hand

Joined: Nov 26, 2010
Posts: 115

i'm sorry..it will actually be from 0 to 9999,because i<10000 and not i<=10000
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage collection