Skip to content
Prev 14038 / 15075 Next

Large number calculations causing system crash

Carl,

this is more than expected - your machine simply does not have enough memory for the computations you are trying to do, so at some point it crashes due to over-committed virtual memory. macOS tries really hard to not raise out-of-memory exceptions, sometimes to its detriment. The crash you're sending is just one of the random processes (your window session) you have that got killed when the memory ran out.

The code you sent needs ca. 33GB for the computation, but you have only 16GB. 

This is not a memory leak, just look at what you are generating: your kterm object for j2=10 is ca. 7.5GB alone (3e6 values at 1e5 precision, that is ca. 2.5k per value so 7.5GB). Now you need at least 3x as much for computation to hold the intermediate terms. So really, it's far more efficient to pick smaller chunks as they will compute faster and need less memory.

Cheers,
Simon