Unexpected Matlab memory usage increasing when an output of function send to main script
A MATLAB program is experiencing severe memory issues when using parallel processing (parfor). The program generates a series of ECell objects, storing them in a 20×20 object matrix. Despite the total size of this matrix being only about 120KB, the program’s memory usage rapidly increases to over 20GB when using parfor, eventually causing MATLAB to crash. This excessive memory usage occurs as soon as one of the parallel iterations completes and attempts to store its result in the main matrix.