Profiling memory use in Matlab

The post on describes an undocumented option of the Matlab profiler that allows for measuring memory bottlenecks.

In short, you switch it on with

profile -memory on;
profile('-memory','on'); % alternative

2 thoughts on “Profiling memory use in Matlab

  1. Robert

    % MEMPROFILE ON starts the profiler and clears previously recorded
    % profile statistics.
    % MEMPROFILE OFF stops the profiler.
    % MEMPROFILE RESUME restarts the profiler without clearing
    % previously recorded memory statistics.
    % MEMPROFILE CLEAR clears all recorded profile statistics.
    % STATS = MEMPROFILE(‘INFO’) returns a structure containing the
    % current profiler statistics.


Leave a Reply

Your email address will not be published.