memory clear function