The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Memory leak in file DELETE in R2010b?
Replies: 3   Last Post: Sep 4, 2012 3:43 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Kevin Hung

Posts: 90
Registered: 12/7/04
Memory leak in file DELETE in R2010b?
Posted: Apr 1, 2011 5:34 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

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?



%% Create file1.mat in current directory.
file1 = 'file1.mat';

for n = 1:100

%% Create file2.mat.
file2 = 'file2.mat';
copyfile(file1, file2);

%% Delete file2.mat.
if exist(file2, 'file') ~= 0
if exist(file2, 'file') ~= 0
error('Cannot delete file2.mat.');


Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.