Results 1 to 3 of 3
Thread: How to use the garbaje collector
- 06-29-2007, 01:48 AM #1
Senior Member
- Join Date
- Jun 2007
- Posts
- 111
- Rep Power
- 0
- 06-29-2007, 01:53 AM #2
Member
- Join Date
- Jun 2007
- Posts
- 95
- Rep Power
- 0
As a general statement you don't care if an object is no longer needed. But this means that you need to be careful. Unlike C++ you don't have an explicit destructor. Therefore you need to make sure you clean up after anything like database connections before the object goes out of scope.
I guess I'm not a fan of System.gc() - before the Java Virtual Machine throws an OutOfMemoryException it will do everything it can to clean up memory. If you're calling System.gc() it may help a little bit but I guess I question that it is going to do much for you. A decent Java program doesn't need to do it - know where memory is allocated and make sure you don't have references to it when youd don't want them.
greetings,
Felissa:p
- 06-29-2007, 01:56 AM #3
Member
- Join Date
- Jun 2007
- Posts
- 91
- Rep Power
- 0
Similar Threads
-
Interacting with the Java Garbage Collector
By Java Tip in forum Java TipReplies: 0Last Post: 03-28-2008, 08:04 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks