Restore free memory test & count cookie

Change-Id: I5aee6d8b6a27c87b0265a5deee25e6e6f3f17f17