optimize memory initializer if it is large