• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

how to call garbage collector implicitly...

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can any one tell me, How to call a garbage collector implicitly other than using System.gc();
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
urai pandiga,
what a stupid question did u ask us
nobody will respond to u.
stop sending such question
and buy one complete refernce and learn some tips from ur frnz like jeens
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The Garbage collector will invoke automatically for every reggular intervals of time (i.e for every 31 sec).if you don't use your object up to that min time the grabagecollector will remove it from heap and reclaim the memory which is occupied by your object.
If you want more information about GC plz have a glance at Thinking in Java.

Thanks & Regards,
G Sirish Reddy.,
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

You cannot call the Garbage Collector. By calling System.gc(), you are only suggesting to the JVM some objects might be eligible for garbage collection.

Anyway, the other way to do this is: Runtime.getRuntime().gc()
 
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Reddy : if you don't use your object up to that min time the grabagecollector will remove it from heap and reclaim the memory which is occupied by your object.


Is it so ?

The garbage collector will reclaim the memory only when the object is not referenced by any active threads . If an active thread has reference to any of the object that will not be GC'd.

Also we cant force the JVM to do the garbage collection, even if you call System.GC() it's uncertain that the objects that are eligible for garbage collection will be removed from heap.
[ September 15, 2005: Message edited by: Srinivasa Raghavan ]
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jeevan saini:
urai pandiga,
what a stupid question did u ask us
nobody will respond to u.
stop sending such question
and buy one complete refernce and learn some tips from ur frnz like jeens


Jeevan,
Please try to post in english, as this thread is for international readership.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic