Better memory handling - avoid out-of-memory errors during build.