Unload matrix and free memory

I can load the matrix from a text file:

load mydata.txt

      

The problem is that my matrix file is about 250MB and after several such loads I have no memory to work with the following files.

How can you unload it and free up resources for future use?

+3


source to share


3 answers


Use clear or clearvars , By default MATLAB will create mydata variable as a result of your assertion, so



clear mydata

      

+4


source


Find variables in your workspace that contain large datasets both in your script or from a console type

clear whateverVariableName

      

To clear all memory usage



clear all

      

You can right click on individual variables in the workspace editor and delete them using the IDE if you like.

0


source


What do you need to do clear mydata

and then release pack

. The first command tells Matlab that a reference to the memory stored for mydata is no longer needed. The second command tells Matlab to free unused memory. If you don't pack

, then the memory will be freed when the Matlab memory manager makes a decision.

0


source







All Articles