views:

96

answers:

3

I am looking for a simple program that can demonstrate memory leak in Java.

Thanks.

A: 

A great example from a great book: http://www.informit.com/articles/article.aspx?p=1216151&seqNum=6

nc3b
Requires login.
Esko
@Esko: Not for me. Perhaps it's a geographic issue ?
nc3b
@nc3b: Well if it's geographic, then you better edit in the content of that link since this site is very much international.
Esko
@Esko: I didn't say there's something special with my location (trust me, there isn't). I meant there's something completely wrong with yours. If all else fails use a web proxy (I'm almost sure you'll get *that* right). If that fails too: http://pcproblems.files.wordpress.com/2007/05/dilbert2007029326511.gif
nc3b
A: 

Memory leak are for example if you have references that are not necessary any more but can't get catched by the garbage collector.

There are simple examples e.g. from IBM that shows the principle:

http://www.ibm.com/developerworks/rational/library/05/0816_GuptaPalanki/

Roflcoptr
+2  A: 

http://www.codeproject.com/KB/books/EffectiveJava.aspx

See Item 6.

Vladimir Ivanov