cleanup and reduce garbage generation