cleanup memory during tests