Reduce CPU load caused by collect_garbage logic running more often than needed