Java and Large Applications
- From: "G. Ralph Kuntz, MD" <grk@xxxxxxx>
- Date: 1 Jun 2005 09:43:20 -0700
I'll probably get flamed, but...
I just spent the morning fixing my umpteenth "memory leak" in a large
Java application (~200,000 lines) that I have been writing for several
years. Again, it turns out to be "hidden" pointers inside Swing that
hold on to DefaultMutableTreeNodes even though I explicitly set the
tree root to null (the hidden pointer has to do with TreePath). This
prevents the 200,000 tree nodes from being garbage collected until the
tree itself is freed.
When I first started learning C++ about 20 years ago, I had an implicit
distrust in a language with so many "side-effects" in the underlying
library that I could never know about.
I considered (toyed with) the idea of rewriting my Java app in C. Of
course, it would probably be 1,000,000 lines long, but at least I could
control every memory allocation and deallocation.
So much for garbage collection.