[#1988] Record memory usage for tests.