title: Matlab R2017a memory profiler gives a ridiculous number for allocated memory
body: <p>My code is:</p>
  
  <pre><code>function eigs_mem_test
      N = 20000;
      density = 0.2;
      numOfModes = 250;
      A = sprand(N, N, density);
  
      profile -memory on
      eigs(A, numOfModes, 0.0)
      profile off
  
      profsave(profile('info'), 'eigs_test')
      profview
  end
  </code></pre>
  
  <p>And this returns</p>
  
  <p><a href="https://i.stack.imgur.com/8BKNT.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8BKNT.png" alt="enter image description here"></a></p>
  
  <p>i.e. it says that MATLAB allocated 18014398508117708.00 Kb or 1.8e10 Gb -- completely impossible. How did this happen? The code finishes with correct output and in htop I can see the memory usage vary quite a bit, but staying under 16G.</p>
  
  <p>For N = 2000, I get sensible results (i.e. 0.2G allocated.)</p>
  
  <p>How can I profile this case effectively, if I want to obtain an upper bound on memory used for large sparse matrices?</p>
  
  <p>I use MATLAB R2017a.</p>