implemented memory debugging