The post on http://undocumentedmatlab.com/blog/undocumented-profiler-options/ 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
how do i switch it off?
% 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.