Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Memory leak in file DELETE in R2010b?
Posted:
Apr 1, 2011 5:34 PM
|
|
Hi everyone,
Can someone kindly try out the following Matlab codes? I am not sure if I have found out a memory leak in using DELETE to simply delete a file.
I bracketed the DELETE command with the MEMORY command so that I can see the memory usage before and after calling DELETE.
Look at the line "Maximum possible array: ....". This number is constant at the beginning but before we hit 100 iterations, this number will decrease.
This took me 3 hours to find out. Am I missing something?
Kevin
--------------------------------------------------------------------------------
%% Create file1.mat in current directory. file1 = 'file1.mat'; save(file1);
for n = 1:100 %% Create file2.mat. file2 = 'file2.mat'; copyfile(file1, file2);
%% Delete file2.mat. if exist(file2, 'file') ~= 0 memory delete(file2); memory fprintf('--------------------------------------------\n\n'); end if exist(file2, 'file') ~= 0 error('Cannot delete file2.mat.'); end
end
|
|
|
|