MatLab have memory leaks?
Mostra commenti meno recenti
When I open MatLab at the beginning it takes up less than 200k in memory. When I open a Simulink model it jumps up to over 300k and every time I press the play button it add 1-2k onto the total memory usage. Sometimes when I run, I get a segmentation violation crash. Its’ happened quite a bit today, but I’m not able to recreate it. I looked the error up and it said that it usually happens when you access something outside of an array index.
I tried to get my program to crash and I threw everything I had at it but to no avail. I checked my memory usage and I was over 700k. I did a clear all and it only freed up about 5k. I didn’t know if it was cause by me trying to access a memory location that was leaked. Does MatLab free up its own memory, or is there a way for me to check to see if anything was leaked?
EDIT:
MATLAB crash file:T:\Temp\matlab\matlab_crash_dump.4064-1:
------------------------------------------------------------------------
Segmentation violation detected at Mon Jul 02 15:01:04 2012
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Default Encoding: windows-1252
MATLAB Root : K:\PROD\wnt\matlab\2012a\win32
MATLAB Version : 7.14.0.739 (R2012a)
Operating System: Microsoft Windows XP
Processor ID : x86 Family 6 Model 23 Stepping 10, GenuineIntel
Virtual Machine : Java 1.6.0_13-b03 with Sun Microsystems Inc. Java HotSpot(TM) Client VM mixed mode
Window System : Version 5.1 (Build 2600: Service Pack 3)
Fault Count: 1
Abnormal termination:
Segmentation violation
EDIT2:
I started in 2010a and moved to 2012a (both 32-bit) and the memory leaks only appear in 2012a. So something that was changed in-between the 2 versions is the cause of it. Simulink takes about twice as long to open in 12a as it did in 10a also.
We got a new computer, Windows 7/64-bit, and we did the same thing and there was no memory issue. The crash that I had above I think was a syntax change between versions in the s-functions that we’re using. Once I recompile those I think the crashing should go away, if what I think is wrong is actually wrong.
2 Commenti
Sean de Wolski
il 2 Lug 2012
OS and bitness?
Jenn Lee
il 23 Lug 2012
I think he was asking what operating system are you using and what is its bit size
Risposta accettata
Più risposte (2)
Malcolm Lidierth
il 3 Lug 2012
Modificato: Malcolm Lidierth
il 3 Lug 2012
2 voti
It looks like a mex-file is accessing MATLAB workspace memory but you are indexing using a pointer outside of the bounds of the array that has been allocated.
You see the exception sometimes but not always because its just chance whether the pointer will access a memory location that MATLAB is using and regards as valid.
Often, this turns up with an out-by-one errors running though an array. One that took me a while to figure out was pre-allocation using char(zeros...). The empty string space is reclaimed when you pass it on the RHS to a mex.
Jan
il 2 Lug 2012
1 voto
Without doubt this is no usual behavior of Matlab. Please try to run only built-in code, e.g. benchmark and some examples. If this looks stable, the problem is most likely in user-defined code. Usually faulty C-Mex files cause such problems.
It could be a hardware problem also. Does other software run well on your system? Did you run a RAM- and CPU-test program already?
Categorie
Scopri di più su Startup and Shutdown in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!