By bloid
via blogs.oracle.com
Published: Sep 18 2007 / 14:41
Memory Leaks? We have a Garbage Collector!
True. Java comes with a Garbage Collector and makes reclaiming of heap space easier. On the other hand, Java offers a number of features, which, if used carelessly, can be the root for your memory leak nightmares.
Comments
raveman replied ago:
wtf? we should worry when we use inner classes or anonymous inner classes ? i always said that OOP is stupid.
kdavies replied ago:
This is dumb. Anytime you are do a cache you have to be careful, whether you are using an inner class or not. Even if you are using an ordinary object in a cache it keeps references to all the objects in it fields so they won't be garbaged collected. If you cache an object you keep an object and all the things it refers to in memory. That is the whole point of the cache.
Voters For This Link (10)
Voters Against This Link (2)