(WIP) Fixes #1223. Uses JMX to find out when to force GC.

This is take 2 of the force GC.
I am wondering if we can use JMX to query `getObjectPendingFinalizationCount` instead of GCing after ALL task evaluation. This should resolve the `~compile` situation.

@cunei @jsuereth Do you have some test case that I can use to see if this fixes #1223 and that it won't blow up with `~compile`?