Azzera filtri
Azzera filtri

memory lost with a simple code

2 visualizzazioni (ultimi 30 giorni)
Nikolay Vinnichenko
Nikolay Vinnichenko il 5 Gen 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

Risposte (0)

Categorie

Scopri di più su Get Started with MATLAB in Help Center e File Exchange

Tag

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by