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

Garbage collection on Connection Factory

Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi All,
I've noticed in some example code from various sources, that before returning a connection object to a remote client, they make a call to System.gc(). Is this necessary or desireable?
Thanks for your opinions
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Not necessary. In my opinion. But why would you need that?
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Frank Zheng
Ranch Hand

Joined: Jun 12, 2001
Posts: 76
Hi,
You may want to set some not used variables to null to help garbage collection. But, you need not call System.gc()and you will never know when the garbage being collected.
Hope this helps,
Frank


Sun Certified Java Programmer
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Hi Mark,
I don't see any point in it either. I've just seen several code examples in books I've read that request gc in that situation. I just wanted to make sure there wasn't some rule of thumb that I was unaware of.
Thanks,
Michael Morris
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Garbage collection on Connection Factory