# SystemException[MemoryAllocationFailure] with Memoized function [closed]

Version 10.1 Win7x64 Enterprise.

This is more of a report than a question but others may have seen the same / have insights.

I have some code (that I can't really post as it's too big) with a large memoized function (there's about 2Gb sitting in that functions UpValues).

Sometime during a loop that was using that function I hit this...

Throw::sysexc: Uncaught SystemException returned to top level. Can be caught with Catch[[Ellipsis], _SystemException].

Returning this...

SystemException[MemoryAllocationFailure]

I'm very much assuming that this may have something to do with the large amount of memory taken up by that function and of course that may be entirely a red-herring. The function processes a Dataset with a FoldList running through the records but really only does arithmetic in terms of mathematical operation.

Uses Apply, Sequence, MapThread, Transpose, Thread, Keys, Values, Query, Dataset, Module, Append, Normal, Association, Lookup, Function, SortBy, Join.

## closed as off-topic by Michael E2, dr.blochwave, m_goldberg, MarcoB, Bob HanlonJul 19 '15 at 6:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Michael E2, dr.blochwave, MarcoB, Bob Hanlon
If this question can be reworded to fit the rules in the help center, please edit the question.

• Try Share[] in the loop. Try to use Block instead of Module. Try Linux. Buy more RAM. If this all fails get a consultant. – Rolf Mertig Apr 9 '15 at 12:02
• Try Matlab? (only kidding). I have plenty of RAM (process uses 2Gb out of 16). This did not happen in 10.0.2 to which I am now returning until 10.1.1. – Ymareth Apr 9 '15 at 12:30
• I'd be surprised if 10.0.2 is using less memory, for the same computations, than 10.1. Also, if nobody here is cognisant of the underlying problem (assuming there was an adverse change), then it a fix in 10.1.1 would only occur by accident. – Daniel Lichtblau Apr 9 '15 at 16:05
• I don't believe it is running out of memory, which in a physical sense its not. I just think its broken. I guess there are a variety of possible causes for an allocation failure of which running out of memory is but one. If I have time I will investigate more but the day job calls at the current time :( – Ymareth Apr 9 '15 at 16:22
• A single function evaluation can cause this message, which I assume means Mma requested more memory than is available. You might never see the memory usage go up. (Example: Erfc[-4.1*^7].) Catch[..., _SystemException, {##} &]` will output a stack trace; the last entry will be the command that gave rise to the error. I think more details have to be added for this question to become answerable. – Michael E2 Jul 18 '15 at 16:32