Does Matlab r2017a manage memory differently than r2016b? (out of memory issues)
3 views (last 30 days)
Show older comments
I recently inherited a set of Matlab scripts that analyze some fairly large datasets. They were written on a Windows 10, core i5 x64 system with 8GB of RAM using Matlab R2016b, and ran to completion without issue. After setting up a new system (Windows 10, core i7 x64, 16GB RAM), I installed Matlab R2017a and ran into "out of memory" errors running the same set of scripts that worked fine on the older system.
Specifically, both systems cruise along for most of the script with Matlab using ~4GB of memory. At a specific point in the script that requires additional resources, the "old" system (r2016b) manages to allocate an additional ~2GB of memory (thereby using ~6GB out of its total 8GB), while the new r2017a system (with 16GB total, and a full 8GB remaining either free or in standby) throws an "out of memory" error instead. The dataset used is identical in both cases.
The behaviour is the same after Windows has freshly booted, with no other applications running. Importantly, I have now also installed r2016b on the new machine, and the scripts run to completion in r2016b without issue (so it would appear that it is the version of Matlab, not the new hardware or some sort of windows misconfiguration that is causing the problem).
While I am well aware of the benefits of optimizing memory management, particularly with large datasets, that is not the question I need answered at the moment (I will dig into optimization down the road, regardless). The specific issue I would like to resolve is whether Matlab 2017a handles memory allocation differently than 2016b, and/or if there is some configuration option I might be unaware of that could account for this difference? I could stay on r2016b for a while (or install multiple versions), but I'd rather deal with the cause of the problem rather than avoiding it.
Thank you to anyone who might have some ideas on this.
1 Comment
moodyds
on 2 Oct 2018
I am experiencing a similar situation. Have a Windows 10 machine with 128GB of memory. When I boot Matlab up, it states that it only sees 24GB of memory available for all arrays event though my system shows more than 70GB of memory available. I have increased the JAVA heap size to its max and removed any limit on array size. I rebooted Matlab as it said to do and I continue to see a limit of 24GB even though more than 70GB available.
Answers (1)
Philip Borghesani
on 12 Sep 2017
There were no global changes in how R2017a manages memory. I expect your problem is due to a change in one function. What function throws the error (post full error message and stack) and can you verify the inputs are the same in both versions of MATLAB?
The more information you can supply about your code and error the more likely you are to receive a helpful response here.
There are two settings that control memory limits and use but it does not sound like you are bumping into one of them.
2 Comments
Philip Borghesani
on 8 Nov 2017
That error message is not a generic out of memory error. It is a stack overflow, which is most likely caused by infinite recursion but could also be caused by an out of memory condition preventing the stack from growing. Before running the code issue dbstop if caught error and when the debugger breaks type dbstack and observe.
If there are too many exceptions happening in your code you can try:
dbstop if caught error MATLAB:lang:StackOverflow
It is possible that this error id is not correct for your version of MATLAB to find the correct id issue lasterror from the command line after experiencing the error.
See Also
Categories
Find more on Install Products in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!