Is there an elegant way to automatically fire memory warnings to my Java application when free memory reaches a certain threshold?
Note that this is a Jeopardy-style question to which I already have an answer, just wanted to post it here for the world to discover because the solution helped me a bunch.
Here’s a great little class written by Heinz Kabutz that works flawlessly for me “out of the box”. Found it in an old “Java specialists” issue: http://www.javaspecialists.eu/archive/Issue092.html
Usage: