Naive implementation of making gc_collect_cycles hookable.