memory lost with a simple code

1 view (last 30 days)
Nikolay Vinnichenko
Nikolay Vinnichenko on 5 Jan 2020
Hello!
I was trying to optimize my image-processing software to make it use less memory and was very surprised to see that the very first function, which simply requests the user to specify a folder, writes it to file, then displays its path in a text element and makes two more text elements invisible, - results in decrease of the memory available for all arrays by 33 Mb! Where are they gone?
Here is the function code:
function SetCurrDir
global currdirpath hTxtCurrDir hTxtProcessDisplDone hTxtProcessContinueDone
currdirpath=uigetdir;
fid1=fopen('CurrDir.txt', 'wt');
fprintf(fid1, '%s', currdirpath);
fclose(fid1);
set(hTxtCurrDir, 'String', {'Current directory is', currdirpath}, 'Visible', 'on');
set(hTxtProcessDisplDone, 'Visible', 'off');
set(hTxtProcessContinueDone, 'Visible', 'off');
clear fid1;
end

Answers (0)

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!