Bug introduced in 10.0 and fixed in 10.1
Warning: the code below may hang your system if you have the Suggestions Bar enabled in Mathematica < 10.1.
When issuing the following simple statements to Mathematica, it responds with a valid answer. However, immediately afterwards one of the two kernels (WolframKernel.exe) goes on a memory frenzy and eats up all RAM, apparently without bounds.
Input:
cols = Table[Symbol[ToString@col <> ToString@row], {col, {a, b, c, d, e, f, g,
h, i}}, {row, 9}];
# == 0 & /@ (Times @@@ Table[cols[[1, k]] - j, {k, 9}, {j, 9}])
Output:
{(-9 + a1) (-8 + a1) (-7 + a1) (-6 + a1) (-5 + a1) (-4 + a1) (-3 + a1) (-2 + a1) (-1 + a1) == 0,
(-9 + a2) (-8 + a2) (-7 + a2) (-6 + a2) (-5 + a2) (-4 + a2) (-3 + a2) (-2 + a2) (-1 + a2) == 0,
(-9 + a3) (-8 + a3) (-7 + a3) (-6 + a3) (-5 + a3) (-4 + a3) (-3 + a3) (-2 + a3) (-1 + a3) == 0,
(-9 + a4) (-8 + a4) (-7 + a4) (-6 + a4) (-5 + a4) (-4 + a4) (-3 + a4) (-2 + a4) (-1 + a4) == 0,
(-9 + a5) (-8 + a5) (-7 + a5) (-6 + a5) (-5 + a5) (-4 + a5) (-3 + a5) (-2 + a5) (-1 + a5) == 0,
(-9 + a6) (-8 + a6) (-7 + a6) (-6 + a6) (-5 + a6) (-4 + a6) (-3 + a6) (-2 + a6) (-1 + a6) == 0,
(-9 + a7) (-8 + a7) (-7 + a7) (-6 + a7) (-5 + a7) (-4 + a7) (-3 + a7) (-2 + a7) (-1 + a7) == 0,
(-9 + a8) (-8 + a8) (-7 + a8) (-6 + a8) (-5 + a8) (-4 + a8) (-3 + a8) (-2 + a8) (-1 + a8) == 0,
(-9 + a9) (-8 + a9) (-7 + a9) (-6 + a9) (-5 + a9) (-4 + a9) (-3 + a9) (-2 + a9) (-1 + a9) == 0}
Memory consumption is beyond 32GB within a few seconds.
I am running Win8.1x64 with Mathematica 10.0.2.
Interesting sidenote:
Thanks to your kind comments, we found, that this is directly connected to the Suggestion Bar being active.
But: Even after turning it off, the memory consuming behavior can easily be triggered by calling
Solve[]
on the output: All available system memory and more is consumed within seconds again (not surprisingly, though, since the solution space is $9^9=387,420,489$, if I am not mistaken). So, it might be assumed, that the suggestion bar internally also callsSolve[]
on the result, which might give us some more insight into how Mathematica's frontend works.
Using FindInstance[]
and ByteCount[]
I found, that one solution takes up 12,416 bytes on my machine. Therefore: Should you have 4,810,212,791,424 bytes of RAM to spare (i.e.: > 4.37 TB), you should actually be able to execute a successful Solve[]
on that output - and also keep the Suggestion Bar activated. ;)