• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Garbage collection on Connection Factory

 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not necessary. In my opinion. But why would you need that?
Mark
 
Frank Zheng
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Michael Morris
Ranch Hand
Posts: 3451
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic