Bug introduced in 10.0 and fixed in 10.1

When I run the following (simplified) code with FindInstance, my MemoryInUse is constantly increasing:

$HistoryLength = 0
FindInstance[x + y == 100, {y}];
memory = MemoryInUse[],
{x, 1, 1000}]
, memory]

I figured maybe there was some cache behavior that was accumulating memory, but I haven't had any luck with ClearSystemCache. I don't see anything particularly helpful in the FindInstance help. Any ideas?

I'm using 10.0.0 student edition on Windows 8.

Update: It seems (from the comments) that it might be a version issue or something specific to my setup. If anybody can reproduce this (i.e. memory increasing linearly throughout the loop), please comment.

Update 2: I upgraded from 10.0.0 to 10.0.2 and the leak in the test above disappeared -- memory usage now plateaus immediately and remains (roughly) constant throughout the loop. Unfortunately it still seems to leak in my actual code. When I comment out the FindInstance line (which has nothing else on it), memory is constant across loop iterations, but it's linearly increasing across the iterations when I leave FindInstance in there.

Update 3: I upgraded from 10.0.2 to 10.1.0 and now the issue is gone entirely -- memory is constant across loop iterations both in the test code and my actual code.

  • $\begingroup$ Which version are you using? Does not occur in 9.0.1. (Or, rather, it quickly reaches a plateau and does not increase any further.) $\endgroup$ Apr 20 '15 at 17:21
  • $\begingroup$ I'm not seeing such a leak in 10.0.2 or 10.1.0. I'm also not sure your test is appropriate. A better test is to check MemoryInUse[] before and after the Do loop is performed. Repeatedly running this test reveals no leaks that I can see. $\endgroup$
    – Stefan R
    Apr 20 '15 at 17:24
  • $\begingroup$ I'm using 10.0.0 student edition of Windows 8. For me, MemoryInUse just increases linearly throughout the loop. @StefanR - the issue is that in the real application, I run out of memory before completing the desired number of iterations in the loop, hence my interest in the memory usage within the loop, which should logically be constant across the iterations. $\endgroup$
    – Shane
    Apr 20 '15 at 17:32
  • $\begingroup$ On my friend's Apple 9.0.1, it immediately plateaus as Oleksandr R. describes, so maybe it is a version issue. Strange. $\endgroup$
    – Shane
    Apr 20 '15 at 17:37
  • $\begingroup$ We have the same problem on Mathematica 11.0.1 for Linux x86 (64-bit) $\endgroup$
    – flagg19
    Mar 20 '19 at 11:36

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.