Free up memory before disabling gc.

It is recommended to call gc_collect_cycles(); before disabling garbage collection.