Skip to content

Commit 8380b19

Browse files
committed
250907.173604.CST [skip ci] revise perfdata.m and perfprof.m regarding clear and close
1 parent e3b240e commit 8380b19

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

matlab/tests/private/perfdata.m

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,11 @@
9898
prof_output{iprec} = perfprof(frec, fmin, prof_options);
9999
%dataprof(frec, fmin, pdim, prof_options);
100100
end
101-
% Clear the variables to save memory. Otherwise, on GitHub Actions, the memory may be exhausted and
102-
% cause the runners to shut down.
101+
102+
% Clear variables to release the memory associated with them. This is important if memory is
103+
% limited, e.g., when we run the tests on GitHub Actions with GitHub-hosted runners. Without doing
104+
% this, the hosted runners may shut down due to memory exhaustion, as it happened on 20250731 with
105+
% MATLAB R2025a.
103106
clear('frec', 'fmin', 'pdim', 'plist');
104107

105108
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -155,10 +158,11 @@
155158
set(gcf,'position',[0, 0, 4600, 920]);
156159
saveas(hfig, epsname, 'epsc2');
157160

158-
% Close all figures. Closing figures can release memory associated with them, which is important
159-
% when we run the tests on GitHub Actions with GitHub-hosted runners Without doing this, the hosted
160-
% runners may shut down due to memory exhaustion, as it happened on 20250731 with MATLAB R2025a.
161-
close all;
161+
% Close the figure to release the memory associated with it. This is important if memory is limited,
162+
% e.g., when we run the tests on GitHub Actions with GitHub-hosted runners. Without doing this, the
163+
% hosted runners may shut down due to memory exhaustion, as it happened on 20250731 with MATLAB
164+
% R2025a.
165+
close(hfig);
162166

163167
% Try converting the eps to pdf.
164168
try

matlab/tests/private/perfprof.m

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@
9999
end
100100
end
101101

102+
% Clear variables to release the memory associated with them. This is important if memory is
103+
% limited, e.g., when we run the tests on GitHub Actions with GitHub-hosted runners. Without doing
104+
% this, the hosted runners may shut down due to memory exhaustion, as it happened on 20250731 with
105+
% MATLAB R2025a.
106+
clear('frec', 'fmin');
102107

103108
% pp{is, ir} is the performance profile of the is-th solver during the ir-th run.
104109
pp = cell(ns, nr);
@@ -147,6 +152,12 @@
147152
end
148153
end
149154

155+
% Clear variables to release the memory associated with them. This is important if memory is
156+
% limited, e.g., when we run the tests on GitHub Actions with GitHub-hosted runners. Without doing
157+
% this, the hosted runners may shut down due to memory exhaustion, as it happened on 20250731 with
158+
% MATLAB R2025a.
159+
clear('T');
160+
150161
% For each solver, we average the performance profiles across the random runs. The resultant profile
151162
% for the is-th solver is recorded in perf_prof{is}.
152163
perf_prof = cell(1, ns);
@@ -233,6 +244,12 @@
233244
epsname = fullfile(options.outdir, strcat(figname,'.eps'));
234245
saveas(hfig, epsname, 'epsc2');
235246

247+
% Close the figure to release the memory associated with it. This is important if memory is limited,
248+
% e.g., when we run the tests on GitHub Actions with GitHub-hosted runners. Without doing this, the
249+
% hosted runners may shut down due to memory exhaustion, as it happened on 20250731 with MATLAB
250+
% R2025a.
251+
close(hfig);
252+
236253
% Try converting the eps to pdf.
237254
try
238255
system(['epstopdf ',epsname]);

0 commit comments

Comments
 (0)