trim feature and memory usage debugging