4
$\begingroup$

Recently I'm trying creating a 80000 x 80000 sparse array in Mathematica, and I discovered a strange thing when using SparseArray[].

Code: s = SparseArray[{{1, 1} -> 1}, {80000, 80000}]

When I run this code in Wolfram Documentation window (find an example randomly, and replace it with this code, then run), the memory usage of WolframKernel almost remains the same. However, when I run that code in Notebook window, WolframKernel's memory usage increases greatly up to ~40 GB, and when that happens, other variables in this Notebook are erased.

I'm wondering what's the difference between the two environment, and is a 80000 x 80000 sparse array in Mathematica, with few specified elements, really takes up to over 1GB?

The version of Mathematica is 11.2.0.0, and the OS is macOS 10.13.4.

$\endgroup$
2
  • 2
    $\begingroup$ On my computer it works well. However, it is possible that your machine under certain conditions performs unpacking of the SparseArray. I'm not expert in this but try looking at discussion under this thread. $\endgroup$
    – ercegovac
    May 19, 2018 at 11:02
  • 2
    $\begingroup$ See here and here. This is probably due to the suggestions bar. Try turning it off. $\endgroup$
    – Hugh
    May 19, 2018 at 20:57

1 Answer 1

3
$\begingroup$

This undesirable behavior is caused by the Suggestions bar and can be avoided by turning it off.

$\endgroup$
1
  • $\begingroup$ This solves my problem. It is the fault of the Suggestions bar. $\endgroup$
    – taoky
    May 20, 2018 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.