Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Michael Pilat's <a href="https://stackoverflow.com/questions/3418892/profiling-memory-usage-in-mathematica/3421537#3421537">answer</a> is a good one, and <code>MemoryInUse</code> and <code>MaxMemoryUsed</code> are probably the best tools you have. <code>ByteCount</code> is rarely all that helpful because what it measures can be a huge overestimate because it ignores shared subexpressions, and it often ignores memory that isn't directly accessible through Mathematica functions, which is often a major component of memory usage. </p> <p>One thing you can do in some circumstances is use the <a href="http://reference.wolfram.com/mathematica/ref/Share.html" rel="nofollow noreferrer"><code>Share</code></a> function, which forces subexpressions to be shared when possible. In some circumstances, this can save you tens or even hundreds of magabytes. You can tell how well it's working by using <code>MemoryInUse</code> before and after you use <code>Share</code>.</p> <p>Also, some innocuous-seeming things can cause Mathematica to use a whole lot more memory than you expect. Contiguous arrays of machine reals (and <strong>only</strong> machine reals) can be allocated as so-called "packed" arrays, much the way they would be allocated by C or Fortran. However, if you have a mix of machine reals and other structures (including symbols) in an array, everything has to be <a href="http://en.wikipedia.org/wiki/Boxing_(computer_science)#Boxing" rel="nofollow noreferrer">"boxed"</a>, and the array becomes an array of pointers, which can add a lot of overhead.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload