Improve string memory management when receiving data.