> The above is actually an oversimplification optimisation isn't black or
> white, and no one in there right mind would suggest coding however elegant
> that was resulting in disk thrashing or constant GCing.
Actually, I do suggest code that one might think would result in "constant
GCing", and I aver that I'm in my right mind. More precisely, I suggest that
one code without regard for naive and unfounded superstitions about GC.
The JVM is designed to be very happy with code that creates myriad small
objects of short lifespan. The design principle in Java, if anything, is to
avoid creation of huge numbers of long-lived objects. One can avoid most GC
issues by being careful to dereference unused objects completely and as early
as they're no longer needed.
For almost all Java work one can ignore putative GC optimizations altogether.
For some applications one can tune the GC algorithms as a deployment matter.
I have yet to hear of any where one should actually write code that would
avoid "constant GCing". Even if one did, the more elegant one's code, the
less likely there is to be a problem.

Signature
Lew
visionset - 06 Apr 2007 14:47 GMT
>> The above is actually an oversimplification optimisation isn't black or
>> white, and no one in there right mind would suggest coding however
[quoted text clipped - 10 lines]
> most GC issues by being careful to dereference unused objects completely
> and as early as they're no longer needed.
Well exactly! A form of optimisation, like I say it isn't black and white!
> For almost all Java work one can ignore putative GC optimizations
> altogether. For some applications one can tune the GC algorithms as a
> deployment matter. I have yet to hear of any where one should actually
> write code that would avoid "constant GCing". Even if one did, the more
> elegant one's code, the less likely there is to be a problem.
This is getting futile, I'm sure we agree.

Signature
Mike W