static volatile long gc_notTooOften_last; static volatile long gc_notTooOften_interval = 1000; static void gc_notTooOften() { gc_notTooOften_last = fixTimestamp(gc_notTooOften_last); if (now() >= gc_notTooOften_last + gc_notTooOften_interval) { gc(); gc_notTooOften_last = now(); } }