Borrar filtros
Borrar filtros

memory lost with a simple code

2 visualizaciones (últimos 30 días)
Nikolay Vinnichenko
Nikolay Vinnichenko el 5 de En. de 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

Respuestas (0)

Categorías

Más información sobre Get Started with MATLAB en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by