I recommend to do more debugging next time and see which process exactly is costing you all this. It sounds like a classic memory leak - those can be triggered nondeterministically. Maybe try some of the tools suggested here https://mahdytech.com/2019/01/05/task-manager-memory-info/