13
$\begingroup$

I call the MemoryInUse[] function, and it outputs about 256 Megabytes.

MemoryInUse[]

(*255979528*)

However, my activity monitor tells me Mathematica is using 5.45 GB and WolframKernel is using 2.32 GB.

Moreover, much more memory should be available than what MemoryAvailable[] tells me is available on my 16 GB computer, taking into account the other tasks on my activity monitor which use little memory by comparison.

MemoryAvailable[]

(*6579212288*)

Why is this?

Perhaps Useful Info

  • I am not running anything in Mathematica.
  • $HistoryLength was set to 0 beforehand.

Update with Screenshots

The screenshots below are from different sessions than my original (which I do not have a screenshot of), but demonstrate the same issue.

Example 1

Example 2

Example 3


2nd Update with Screenshots

Here are some other sessions demonstrating the problem.

Example 4

Example 5

Example 6

$\endgroup$
  • 4
    $\begingroup$ Please do not use the bugs tag when posting a new question. Do add this tag to someone else's question if it was verified to be a bug. Please see the tag description for more. $\endgroup$ – Szabolcs Mar 26 at 10:56
  • 2
    $\begingroup$ Can you post a screenshot of the activity monitor, and make sure that the table headings (different kinds of memory measurements) are visible? I cannot see this behaviour with M12.1 on macOS 10.14. Can you give specific steps to reproduce it? (I.e. what do you do to consume this much memory? I tried to create and free some large random matrices and cannot see such a large discrepancy.) $\endgroup$ – Szabolcs Mar 26 at 10:58
  • 1
    $\begingroup$ This question is not easy to answer. One way this can happen is when Wolfram uses an external library that doesn't allow Mathematica to track its specific memory management. But this is only one way. $\endgroup$ – ktm Mar 26 at 19:31
  • 1
    $\begingroup$ MemoryInUse corresponds to the memory allocated in the kernel. It seems accurate in the screenshots. $\endgroup$ – ilian Mar 28 at 22:41
  • 1
    $\begingroup$ Also, these seem to be sessions involving several hundred Out[] results, all of which are stored in memory by default. You may want to set $HistoryLength to a smaller value. $\endgroup$ – ilian Mar 28 at 23:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.