Fix mem error on windows where crash would happen after 30 min