Re: Java and Large Applications
- From: steve <me@xxxxxx>
- Date: Wed, 8 Jun 2005 07:30:39 +0800
On Thu, 2 Jun 2005 00:43:20 +0800, G. Ralph Kuntz, MD wrote
(in article <1117644200.398663.294920@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>):
> 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.
>
> Any thoughts?
>
check out the sun site, it clearly states that setting pointers to null to
cause GC is a BAD IDEA.
making your references weak is far better.
.
- Follow-Ups:
- Re: Java and Large Applications
- From: P.Hill
- Re: Java and Large Applications
- References:
- Java and Large Applications
- From: G. Ralph Kuntz, MD
- Java and Large Applications
- Prev by Date: Re: Number of tests per line of java code
- Next by Date: How to stop message bean?
- Previous by thread: Re: Java and Large Applications
- Next by thread: Re: Java and Large Applications
- Index(es):
Relevant Pages
|