on 02-10-2006 12:55 PM
when and how the garbage collector delete the instance variables LIKE int i,float f;
class{
int i;
float f;
}
Hi Valery,
What I said was it normally runs as a low priority thread but it runs as a high priority one when available memory goes dangerously low(See the answer above).
Regards,
Pooja.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
The <b>Java garbage collector</b> runs as a low-priority thread, so it does most of its work when nothing else is going on, such as during idle time while waiting for user input.
The only time the garbage collector must run while something high-priority is going on (i.e., the only time it will actually slow down the system) is when available memory has become dangerously low. This doesn't happen very often because the low-priority thread cleans things up in the background.
This is actually an automatic process.
Regards,
Pooja.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
If you r using System.gc in your program explicitely it free all the instances other wise of you are not using one particular variable for longer time it would be automatically garbage collected.
I think it help you to solve your problem.
Thanks
Mrutyunjaya Tripathy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guruvulu Bojja,
Garbage Collector: A very good Memory Manager.
You can clear your queries by verifying these links...
1. About Garbage Collector.
http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)
2. The Mysteries of Distributed Garbage Collection
http://www.thinktecture.com/Resources/RemotingFAQ/Lifetime.html
3. Java theory and practice: A brief history of garbage collection
http://www-128.ibm.com/developerworks/java/library/j-jtp10283/
4. Garbage Collection: Automatic Memory Management in the Microsoft .NET Framework
Part-I.
http://msdn.microsoft.com/msdnmag/issues/1100/gci/
Hope it helps.
5. Part-II
http://msdn.microsoft.com/msdnmag/issues/1200/GCI2/
6. Java's garbage-collected heap
http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html(Click on next link to explore more)
7. Reference Objects and Garbage Collection
http://java.sun.com/developer/technicalArticles/ALT/RefObj/
8. GC-FAQ's
http://java.sun.com/docs/hotspot/gc1.4.2/faq.html
Hope it helps.
Regards,
Maheswaran.B
Message was edited by: Maheswaran B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guruvulu,
you can call the garbage collector by hand:
Use
Runtime.getRuntime().gc();
Before and after calling the gc you can check the free memory of your machine:
Runtime.getRuntime().freeMemory();
So you can check if the gc has done something.
Hope it helps,
Kasrten
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when instance itself is deleted.
actually, they (any primitives) are part of instance and resides in memory allocated per instance, JVM / GC does not manage them separately
VS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Guruvulu,
A key feature of Java is its garbage-collected heap, which takes care of freeing dynamically allocated memory that is no longer referenced. Because the heap is garbage-collected, Java programmers don't have to explicitly free allocated memory.
TO have a clear understanding of garbage collection,refer the following link:
http://www.javaworld.com/javaworld/jw-08-1996/jw-08-gc.html
Regards,
Anuradha.B
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.