Why is MATLAB R2019b very slow when clearing large variables from memory?
11 views (last 30 days)
I have a workstation with Intel i7 9900K and 64 GB (DDR4, 3200 MHz) of RAM. My recent project requires me to load 3-8 large structure arrays into the memory, occupying 10-40 GB of memory in total. I find that MATLAB (R2019b update 3) gets very slow when clearing these large variables from workspace. The "clear" command takes 30-60 seconds to finish, and from the Windows task manager I can see the memory usage gradually goes down. This happens even when aborting a function which loads the variables inside. The system has a pagefile of around 9 GB on an SSD but the memory usage (including all programs) never goes beyond 85% of total memory. I hope to know whether such slow clearing speed is a expected MATLAB behavior?