Add freeMemoryForTests

Change-Id: Ib4f0b6609f7b4de759d0e9f0dd058826ba6c0b15