Memory usage improvements
Updated to trunk 10474