I'm experiencing an odd problem of late. My (small) program (max heap 256 MB) uses a lot of large (JavaFX) Images, which are being kept track of in an ImageCache class that uses SoftReferences. After about two dozen of these images have been loaded however, the GC starts going crazy doing lots of small cleans. This shows itself as:
- Lots of GC printing in the log
- One core maxed out
- This continues for a few seconds initially, but with more pics loaded can run minutes(!) at a time
The images however are not being cleaned up at all -- VisualVM reports the heap hovering near its max the whole time. A FUll GC cleans this up... but... the behaviour above continues when the next image is loaded, despite having a heap that isn't even 50% used.
I'm not doing much special in my opinion, it is just a hobby project that I would certainly not expect to run into any kind of GC-type trouble. If anyone can explain this behaviour, I'd be interested. Tested on 32-bit Windows 7, JDK 1.7u2 and 1.7u4 (dev preview).
See below the logs to illustrate this problem (I cut out some of the large GC loops):