Skip to main content
29 votes
Accepted

How do I disable the stack tracing feature in Mathematica 11?

Is there a possibility to disable stack tracing, but keep messages? Internal`$MessageMenu = False reverts back to the old messages. Seems to do the trick and ...
ktm's user avatar
  • 4,242
28 votes
Accepted

What happens if you don't Reap what you've Sown?

Preamble This complements the answer of Roman with a few more details. Reap - Sow implementation is based on an internal object <...
Leonid Shifrin's user avatar
26 votes

How do I disable the stack tracing feature in Mathematica 11?

Analysis current as of Mathematica version 11.0.1 and 11.1.0. We can disable the Show Stack Trace item in the new message menu as follows: ...
WReach's user avatar
  • 69k
22 votes

Is there any harm or benefit to Removing unneeded private symbols in packages?

I decided to take one of my large packages and Remove all symbols in the Private` context that have no definitions attached to them ... And is there any risk if only those symbols that are not used ...
rm -rf's user avatar
  • 88.9k
22 votes

What happens if you don't Reap what you've Sown?

It looks like there's no memory being used by Sow when there is no encompassing Reap. With ...
Roman's user avatar
  • 48.1k
21 votes
Accepted

Computing elements of a 1000 x 60 matrix exhausts RAM

Your function F is implemented really, really inefficiently. By quite simple means and in the proposed situation, it can be sped up by a factor of 20000. The key is ...
Henrik Schumacher's user avatar
19 votes
Accepted

Generating and rendering extremely large graphs

I suggest not to use Graph to render, as it is slow. Instead, compute the vertex coordinates, then render manually. The rough steps are as follows: Create an "...
Szabolcs's user avatar
  • 235k
19 votes
Accepted

Out of memory when computing a coefficient of a large symmetric polynomial

Split it into 3 steps to get result immediately. ...
Akku14's user avatar
  • 17.3k
18 votes
Accepted

SquaresR memory leak?

Cause Under the hood System`SquaresR is still calling functions in the context NumberTheory`. Partial output of: ...
Mr.Wizard's user avatar
  • 272k
15 votes
Accepted

How to force Mathematica to clean up the cache

This is also not an answer (I think you found the culprit and it needs to be solved by WRI) but a suggestion for a workaround. The idea is to run the memory leaking code in an extra kernel and restart ...
Albert Retey's user avatar
  • 23.6k
14 votes

Is this buggy behavoir of Module solved?

IMHO, this is not a bug, but a feature. It allows you to implement pointer-like data structures with garbage collection because symbols in a Module have the ...
Henrik Schumacher's user avatar
13 votes

Memory leak in the system function: how to free memory without restarting the kernel?

Please report this to support. You can get rid of some of the memory leak by executing the following: ...
Carl Woll's user avatar
  • 131k
13 votes
Accepted

Efficient storage of large non-rectangular arrays

Special case Best way would be to not store this thing at all. It has so much structure that a[[i,j]] is cheaply computable on the fly. Integer and double ...
Henrik Schumacher's user avatar
13 votes
Accepted

Garbage collection for lexical closures

Here's an approach to "automate" the usage of the ExpressionCleanup` paclet mentioned by @LeonidShifrin. The idea is to return an object from your module ...
Lukas Lang's user avatar
  • 34.1k
12 votes
Accepted

Memory leak with Mathematica Graph functions

Here is another possible way to eliminate the impact of history, etc. The following code aborts on my machine after printing to the console three times. ...
Victor K.'s user avatar
  • 5,191
11 votes
Accepted

Is there any harm or benefit to Removing unneeded private symbols in packages?

As a more direct answer to the question of memory we can check with a test. ...
Mr.Wizard's user avatar
  • 272k
11 votes
Accepted

PackedArray and Dot results in undesired unpacking

Is it important to do the computation with integers? I have no problem computing this with reals (using N): ...
Anton Antonov's user avatar
11 votes
Accepted

Memory leak with FindMaximum/Minimum inside of Module

Please report this as a bug. A minimal example: ...
Carl Woll's user avatar
  • 131k
11 votes

Garbage collection for lexical closures

If you can afford this from performance standpoint, you can generate definitions at every function call: ...
Leonid Shifrin's user avatar
10 votes

Is this memory leak in VertexDelete a bug?

I can reproduce the problem. A more minimal example is ...
Szabolcs's user avatar
  • 235k
10 votes
Accepted

Memory usage of compiled function: C vs WVM

As suggested in comment of Simon Woods and comment of halirutan, returning an array from "WVM"-CompiledFunction and from ...
10 votes

How to force Mathematica to clean up the cache

Not an answer, just extended clarification There seem to be many types of caching related leaks here. I can get one by just doing this: ...
b3m2a1's user avatar
  • 46.9k
10 votes
Accepted

How to solve this problem 710 of Project-Euler

"when I use the above method to solve t(42), I am prompted that the memory is insufficient. How can I avoid memory overflow errors?" ...
kglr's user avatar
  • 397k
10 votes
Accepted

huge difference in memory usage

Yes, the reason for the greater memory use is that your attemptOne generates the entire set of subsets before performing the summation. Keep in mind that those are ...
MassDefect's user avatar
  • 10.1k
10 votes

huge difference in memory usage

Yes, the list of subsets has to generated first and stored somewhere. This is why attemptOne uses more time and memory, namely $k\, O({n \choose k})$ of both. I ...
Henrik Schumacher's user avatar
10 votes
Accepted

Why are more highly nested lists often not more memory and time-intensive?

A packed arrays (or a MTensor on the C++ side of Mathematica) consists of a linear array containing all entries plus the information needed for storing of the ...
Henrik Schumacher's user avatar
10 votes

Out of memory when computing a coefficient of a large symmetric polynomial

To get the coefficient of $b^\beta c^\gamma d^\delta$, for $\beta=12$, $\gamma=8$, $\delta=6$, we take advantage of the fact that the coefficients $(poly)^n$ are computed by the ...
Michael E2's user avatar
  • 237k
10 votes

Working around Memory Leak from HermiteDecomposition

Thanks to Mathematica Support, I have a workaround for the issue. Running the following code avoids the leak entirely: ...
fireflame241's user avatar
9 votes
Accepted

How to Flatten and stack Efficiently 50000 Images

You can combine @nikie's approach above with the use of a faster built-in import function. If you can forgo all the behind-the-scene checking that Import does, ...
MarcoB's user avatar
  • 67.3k
9 votes
Accepted

How to minimize object size of a large list of strings

The documentation for ByteCount states that ByteCount does not take account of any sharing of subexpressions. The results it gives assume that every part of ...
C. E.'s user avatar
  • 70.7k

Only top scored, non community-wiki answers of a minimum length are eligible