Conditionalize thread local cleaning. Possible perf degradation fix