tag:blogger.com,1999:blog-7955003209126272036.post7088806590404617994..comments2024-02-23T23:16:22.861+05:30Comments on Geek Explains: Java, J2EE, Oracle, Puzzles, and Problem Solving!: Memory Leak in Java? Does 'static' cause it?Geekhttp://www.blogger.com/profile/00648920090539126396noreply@blogger.comBlogger9125tag:blogger.com,1999:blog-7955003209126272036.post-16381494356423034502011-02-09T12:47:19.326+05:302011-02-09T12:47:19.326+05:30thanks for your explainationthanks for your explainationUnknownhttps://www.blogger.com/profile/18378255582563097682noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-45055906469411507682010-06-28T20:40:14.428+05:302010-06-28T20:40:14.428+05:30Hi Gaurav,
The particular section of the article ...Hi Gaurav,<br /><br />The particular section of the article starts with this line <i>'static <b>can't</b> straightway be blamed for causing memory leaks'</i>. Why do you think that I'm blaming static for that? In fact, it's the other way... All I'm trying to say that 'static' can cause a memory leak only when not used effectively. Hope this helps!Geekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-30730475050734547612010-06-15T14:05:41.860+05:302010-06-15T14:05:41.860+05:30I do not agree by your explanation, I declare stat...I do not agree by your explanation, I declare static variable, knowing that it will be alive for the entire scope of application. Hence GC guarantee that by not reclaiming the object (Uses as a root as well for object graph traversal). Having any other usage of static variable is breaking the Oops concepts and there is a design flaw. <br />Whereas a well designed application can have memory leak Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-15046716279817931642010-05-16T12:42:21.652+05:302010-05-16T12:42:21.652+05:30I think you should have noticed the usage of '...I think you should have noticed the usage of <i>'wise handling'</i> and <i>'effectively'</i>.<br /><br />It depends upon the scenario whether one should go with Connection Pooling or Singleton. Not that one fits the bill every time.<br /><br />What if the chances of having more than one thread at one point of time is very less, but we are in a multi-threaded model where new Geekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-60346186777311155682010-05-10T15:53:24.320+05:302010-05-10T15:53:24.320+05:30Not agree with Anonymous...
In case of multiple th...Not agree with Anonymous...<br />In case of multiple threads using same Connection Object it will slow down the performance.. coz .. evry thread hold lock on the connection ..<br /><br />it would be better to use Connection Pooling... and not the singleton.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-44690022041544348632009-12-01T09:29:31.799+05:302009-12-01T09:29:31.799+05:30Nice Explanation.Nice Explanation.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-76548969024848720832009-11-18T20:04:53.450+05:302009-11-18T20:04:53.450+05:30Performance has more to do with the wise handling ...Performance has more to do with the wise handling of the object(s). If Singleton being used effectively, it'll only boost the performance. Suppose, thousands of threads are coming in and they all are using the same Connection object, it's better to make it Singleton instead of forcing all the threads to have their own copies. Hope this helps. Keep posting!Geekhttps://www.blogger.com/profile/00648920090539126396noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-34586301884424006932009-11-18T15:35:06.513+05:302009-11-18T15:35:06.513+05:30How the Singleton object will affect the performan...How the Singleton object will affect the performance of the application?Thangahttps://www.blogger.com/profile/04381851314968167150noreply@blogger.comtag:blogger.com,1999:blog-7955003209126272036.post-1446510036464498922009-11-18T13:49:29.898+05:302009-11-18T13:49:29.898+05:30Thanks For the Explanation.Thanks For the Explanation.Anonymousnoreply@blogger.com