But what about the GC activity when using Weak and Soft Refs ?
A few time ago I used WeakRefs to speed up gc collection on big old objects.
Basically when minor collection occurs (quite often) and when WeakReference is the only reference to the underlying object, referents are reclaimed immediately even if the object is present on oldGen space. That means that we can free OldGen objects with a quick minor GC.
It will be nice to test it with different GC strategies on different JDK versions and platforms.
When major collection occurs, and when SoftReference is the only reference to the underlying object, and when memory is low (what the hell does this mean - before an OutOfMemoryException) their referents are reclaimed. This is a dummy form of lazy loading. The question is how the GC decides which SoftReference to collect (based on size, heap time, random ???).
I used SoftReference for caching (in my case the jdbc calls results). Used with a syncro timer (scheduled refresh) it could be a quite simple and efficient caching method.
In this case you are not very portable (behavior may change) between platforms and java versions.