OutOfMemory(): How to inspect environment memory?

You can also use the functions sizeof and Base.summarysize to print out the size of the objects in your function. Start with a small input so it dosn’t crash. Increase your input by a magnitude and see the growth in memory size.

I recently had out of memory errors, particularly with a matrix 100,000 x 100,000. The element type of this array was Int64. I was only story the numbers 1 to 8 for each element, and substantially reduced my memory consumption by changing the type of each element to Int16.

I actually don’t know whether that affects performance or not (something to do with 64 bit machines and optimal CPU utilization), but it worked for my case.