generational garbage collector brainstorming

Hello.
I was playing with my file system classes, and was thinking on a way to potentially enhance the memory use of those classes.
They store entries, that are files - or whatever- in a fliesystem. As those entries are cached, they might be taken out of Eden and stored as longer life object. Up to here, nothing abnormal.
Now, here is what i thought… When i refresh my cache, my first implementation was to clear the list, read the new one, and return. Simple, efficient… efficient? mhh. maybe not. What if i compared the new cached data of a directory to the old one, and only replace the ones that changed… You might think “hey, you’ve already allocated the new objects… what’s the use for throwing them away, and use more cpu for nothing?”… yes, right… why would i do that?
Well. if those new objects are in Eden, they will be collected sooner than those that are long lived, so my memory use should decrease sooner, and GC should take less time (but should occur sooner).
So… where is the final question…what do you guys think… is this worth the effort?
I’m not sure escape analysis would help some more to reduce garbage on that case, but that would be nice. Do you think that it will? why?

Mhh som many questions, and my tomcat is still not linked ajp13 with apache… damn… i hate them when they need to work toguether… :’(

Could you use something like soft or phantom references to do this? you can have objects that loose references be dropped on a queue instead of being de-allocated by the JVM, and when you need a new instance of an object, you can just pop one off the queue. Better yet, you could have the ‘garbage’ queue indexed in such a way that you could attempt to find an object that was already initialized with a certain state before taking any ol’ one off the queue to re-init. But, that may be more work than you are saving, but did you look into the java.lang.ref package to see if that’s what you want?

-Chris

Yes, i know them, but there, i think we’re entering the ‘reinventing the wheel’ zone. Generational GC is already some kind of an object pool. if it does that for me (and certainly better than i would do) why adding some more over it ?

Moreover, if escape analysis is to clear the allocation problem in my case, object pooling sounds like a bad idea.