tune memory usage to reduce heap requirement