How much memory is used by all functions and subfunctions in my program?
Show older comments
Hi,
I want to know how much memory my program uses during execution. I know that the function whos can be used to list all variables in every workspace. I have tested saving the bytes used by calling whos in every function and saving the size of every variable into a global variable. I thought that, at the end, I would be able to see how much memory my program has used by looking at the global variable. However, I'm encountering a problem. The global variable keeps increasing even after the program has finished, and it seems to never stop.
I'm therefore wondering if there is an easier way to see how much memory the whole program has used?
Answers (1)
per isakson
on 8 Mar 2013
Edited: per isakson
on 8 Mar 2013
0 votes
Search "Strategies for Efficient Use of Memory" in the on-line help
4 Comments
abebe
on 8 Mar 2013
per isakson
on 8 Mar 2013
"The global variable keeps increasing even after the program has finished" sounds weird to me. I cannot help. You provide to little information.
What OS are you using? If Windows you might find http://technet.microsoft.com/en-us/sysinternals useful.
abebe
on 12 Mar 2013
Walter Roberson
on 12 Mar 2013
On MS Windows you can use the MATLAB commands
memory
feature('memstats')
Note: these are not available on the other operating systems.
Categories
Find more on Environment and Settings in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!