Comments on: Undocumented profiler options https://undocumentedmatlab.com/blog_old/undocumented-profiler-options Charting Matlab's unsupported hidden underbelly Sun, 03 Jul 2022 14:46:57 +0000 hourly 1 https://wordpress.org/?v=4.4.1 By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-356388 Thu, 03 Sep 2015 14:38:29 +0000 https://undocumentedmatlab.com/?p=143#comment-356388 @Jabbar – I believe that these are an approximate description of the various reported values:

* Peak memory is the maximal amount of allocated memory during the execution of the profiled line/function.
* Allocated memory is the total amount of memory allocated during the execution. Note that it is a cumulative amount, meaning that if you have an allocation of 1KB in a loop that runs 50 times, you’ll see a 50KB value.
* Freed memory is the total amount of memory de-allocated during the execution. This too is a cumulative amount.
* Self memory is the memory used by the profiled line/function, which is not deallocated (and therefore not included in the “Freed memory” value).

Note that these are speculations: The exact definition of what is reported under which category is internal to Matlab and is currently unknown.

]]>
By: jabbarhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-356270 Tue, 01 Sep 2015 12:49:06 +0000 https://undocumentedmatlab.com/?p=143#comment-356270 Hi dear Yair
i want to know differences between peak memory, self memory, allocated memory and freed memory while we are using Memory monitoring using profiler.
i google it but it seems no one knows about the issue!
thanks in advance.

]]>
By: 2D and 3D Perlin Noise in MATLAB | semifluid.comhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-347053 Mon, 23 Mar 2015 10:12:52 +0000 https://undocumentedmatlab.com/?p=143#comment-347053 […] However interp3 is VERY memory intensive. Here are example MATLAB profiler outputs illustrating the peak memory used by MATLAB (note that I used the undocumented MATLAB profiler memory option “profile -memory on;”, described here): […]

]]>
By: Andrewhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-161324 Fri, 22 Feb 2013 15:21:51 +0000 https://undocumentedmatlab.com/?p=143#comment-161324 Hi Yair,
That’s what I figured, but I thought I would ask for clarification anyway. Thanks so much for your quick response and wealth of knowledge! It seems a bit strange. I can run the same set of functions with the same inputs, but the profiler comes back with different results. And I’ll need to determine if it’s my code or Matlab itself causing the memory growth… Well, I will certainly let you know what I can come up with.
Thanks again!
~Andrew

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-160814 Thu, 21 Feb 2013 20:27:56 +0000 https://undocumentedmatlab.com/?p=143#comment-160814 @Andrew – it should be relatively easy to see where allocated>freed: when there are no leaks, these two should have exactly the same value.

You could also use non-Matlab tools (e.g., Process Explorer for memory leaks or GDIView for GDI handle leaks — both of them for Windows).

Note in advance that hunting down memory leaks in Matlab is very difficult, due to the lack of good monitoring tools (AFAIK).

If you or anyone else find any leaks, please report them here or directly to me. I know for a fact that MathWorks’ dev team are very interested in such inputs — whatever will be reported to me I will pass on to them for fixing.

]]>
By: Andrewhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-160775 Thu, 21 Feb 2013 17:52:35 +0000 https://undocumentedmatlab.com/?p=143#comment-160775 Hi Yair,
Can you explain a little more how you used the profiler to detect leaks? I’m working on a continuously running software (always open, but runs a set of functions/methods every minute or so) that seems to creep up in memory over time. I ran the profiler while executing my code and am trying to understand what I’m looking at. I see allocated, freed, self, and peak memory, but don’t know how that translates to memory growth over time. Any help would be appreciated!

]]>
By: » 2D and 3D Perlin Noise in MATLAB semifluid.comhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-129919 Wed, 05 Dec 2012 13:45:09 +0000 https://undocumentedmatlab.com/?p=143#comment-129919 […] However interp3 is VERY memory intensive. Here are example MATLAB profiler outputs illustrating the peak memory used by MATLAB (note that I used the undocumented MATLAB profiler memory option “profile -memory on;”, described here): […]

]]>
By: Undocumented Profiler options part 4 | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-112756 Wed, 03 Oct 2012 18:02:45 +0000 https://undocumentedmatlab.com/?p=143#comment-112756 […] Past articles explained how to profile memory, improve timing resolution and fix a font issue, and display the call history. […]

]]>
By: Undocumented Profiler options part 3 | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-111556 Wed, 26 Sep 2012 18:01:10 +0000 https://undocumentedmatlab.com/?p=143#comment-111556 […] Past articles explained how to profile memory, improve timing resolution and fix a font issue […]

]]>
By: Undocumented Profiler options part 2 | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-110296 Wed, 19 Sep 2012 18:03:13 +0000 https://undocumentedmatlab.com/?p=143#comment-110296 […] Three years ago I published an article on undocumented profiler options. Since then, I have posted several articles about performance […]

]]>
By: Profiling Matlab memory usage | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-76074 Thu, 01 Mar 2012 00:13:15 +0000 https://undocumentedmatlab.com/?p=143#comment-76074 […] the Matlab Profiler enables monitoring memory usage […]

]]>
By: Matlab-Java memory leaks, performance | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-71570 Fri, 20 Jan 2012 00:56:31 +0000 https://undocumentedmatlab.com/?p=143#comment-71570 […] Matlab Profiler’s undocumented memory profiling option helped me quite a bit, as well as lots of intuition and trial-and-error. Detecting memory leak is never easy […]

]]>
By: Davehttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-61266 Tue, 08 Nov 2011 04:12:33 +0000 https://undocumentedmatlab.com/?p=143#comment-61266 Does this work correctly on Linux?

I got a nonsensical memory value for a mex function (10^16 kB). It is using its own memory allocation internally, though…

]]>
By: Chrishttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-60913 Thu, 03 Nov 2011 22:16:15 +0000 https://undocumentedmatlab.com/?p=143#comment-60913 The -memory option is a great idea. But as @DA states above it can really slow the profiler down. I had to turn it off, with the -nomemory option, to get reasonable performance.

]]>
By: DAhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-32852 Thu, 10 Feb 2011 11:07:44 +0000 https://undocumentedmatlab.com/?p=143#comment-32852 Memory profiling is great, but it does seem to add a lot of overhead, potentially slowing the profiler by many orders of magnitude.

]]>
By: Patrick Mineaulthttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-21156 Wed, 27 Oct 2010 17:46:45 +0000 https://undocumentedmatlab.com/?p=143#comment-21156 Works great over here, although sometimes gives nonsensical values for memory consumption (negative amounts or terabytes, etc.). Linux 64-bit R2009b.

]]>
By: Yair Altmanhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-8634 Tue, 30 Mar 2010 17:42:55 +0000 https://undocumentedmatlab.com/?p=143#comment-8634 @Matthew – please read Scott Hirsch’s comment above. Scott is the Matlab product manager at MathWorks and says that they “would love feedback on the memory profiling feature”. Perhaps you could contact him via the attached link and explain your use-case. There might be a workaround for your Matlab version/platform. Even if not, it might benefit other users who have similar issues. If you learn anything new, please do post it here.

]]>
By: Matthew Davidsonhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-8602 Mon, 29 Mar 2010 19:13:26 +0000 https://undocumentedmatlab.com/?p=143#comment-8602 It doesn’t work for me in 2007B, OS X 10.5. It gives me the following error from callstats.m: “Support for memory tracking is not available with the current memory manager.

This is unfortunate, because lack of memory profiling is one of Matlab’s biggest performance gaps. As someone who works with massive neuroimaging data sets every day, good memory use is more important to me than CPU performance. Shaving an hour or two off an analysis is nice, but using too much memory means my analysis won’t even finish.

As an ex-professional programmer, I’d seriously considered making and selling something like this as an add-on if I wasn’t in grad school.

Maybe in that far-off utopia of infinite funding, I can convince my advisors to buy all the necessary copies of later matlab versions. :)

]]>
By: Markhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-1719 Mon, 13 Jul 2009 06:40:31 +0000 https://undocumentedmatlab.com/?p=143#comment-1719 Good Work

]]>
By: tic / toc - undocumented option | Undocumented Matlabhttps://undocumentedmatlab.com/blog_old/undocumented-profiler-options#comment-858 Fri, 22 May 2009 13:12:12 +0000 https://undocumentedmatlab.com/?p=143#comment-858 […] I have recently discussed undocumented features in Matlab’s built-in profiler. Another tool often used for ad-hoc performance profiling of Matlab code are the built-in duo functions tic and toc […]

]]>