Merge "Update the code to avoid memory issues." am: 1174bce393 am: ee2747ecca

Change-Id: I2a009810ba92276a2e3054539e4f846897eed3ef