added memory logging