Memory leak when calling DOS command in a loop

12 views (last 30 days)
I have running an executable file using the "dos" command. This file is a compiled .lua file doing some calculations :
for i = 1:n
dos('executable.exe');
end
When doing so, the memory is not freed after each iteraction, and at some point it saturates. Clearing workspace, or even quiting matlab does not free the memory either. I have to restart the computer.
I checked that when running the .exe directly in a dos cmd terminal, the problem does not occur.
I am working on 2015a, windows 7 64-bits.
Anyone has an idea of what is going on ?
Thanks a lot in advance.

Answers (1)

Philip Borghesani
Philip Borghesani on 22 Jun 2015
Best guess is that your executable is not exiting cleanly or at all. Check task manager for a large number of some process. Most likely this has noting to do with matlab or the dos command and calling executable in a loop from a batch file would do the same thing.
  3 Comments
Jan
Jan on 21 Jun 2016
@Antonios Georgantas: Please do not post a question as a comment of an answer or another question. Open a new thread instead and insert a link to this thread. Thanks.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!