Java heap space out of memory problem

조회 수: 384 (최근 30일)
Arc Lok
Arc Lok 2016년 1월 2일
이동: Walter Roberson 2024년 11월 20일 20:56
Hello guys,
I have a persistant and very annoying problem with matlab. From time to time (quite frequently, a couple of time a day), matlab starts to freeze without any reason and I hear my computer as if there was some heavy process running (even though there is no matlab process running, and many times it just happens at the start of matlab even before I have done anything). Eventually, either matlab crashes and I have to close it or the freeze stops and I get the error below (and after that matlab runs correctly without problem):
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: GC overhead limit exceeded
It seems to have something to do with java heap space, and for no reason there seems to be something running taking all the space ?? I don't really understand what is happening. I have seen this thread : https://www.mathworks.com/matlabcentral/newsreader/view_thread/240599 where somebody has a related issue. I have tried the fix suggested here (<http://www.mathworks.com/matlabcentral/answers/100335-why-do-i-receive-an-error-when-i-execute-the-fetch-statement-on-a-sql-server-database-using-database>) and I have added a java.opts file in my bin/glnx64 of matlab but it does not seem to fix the issue (although I think the error message are slightly different now, see below).
java.lang.OutOfMemoryError: Java heap space
Failed to retrieve Exception Message
java.lang.OutOfMemoryError: Java heap space
Failed to retrieve Exception Message
Exception in thread "Explorer NavigationContext request queue" Exception in thread "HashSessionScavenger-2" java.lang.OutOfMemoryError: Java heap space
java.lang.NullPointerException
Exception in thread "qtp348499891-116" java.lang.OutOfMemoryError: Java heap space
Exception in thread "BayeuxServer@834743137" java.lang.OutOfMemoryError: Java heap space
Exception in thread "qtp348499891-114" java.lang.OutOfMemoryError: Java heap space
Exception in thread "BayeuxServer@1405793791" java.lang.OutOfMemoryError: Java heap space
Exception in thread "TimerQueue" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Thread-292" java.lang.OutOfMemoryError: Java heap space
Additionally, I have the following java log error file written in my home directory:
Operating System: Linux 4.0.7-200.fc21.x86_64 #1 SMP Mon Jun 29 22:11:52 UTC 2015 x86_64
Processor ID: x86 Family 6 Model 58 Stepping 9, GenuineIntel
Host Name:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "HashSessionScavenger-3"
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "HashSessionScavenger-4"
Exception in thread "main" Exception in thread "main"
Do you have any idea on what causes this issue and how I can fix it ? It is really annoying and make matlab very inconvenient to work with...
Thanks in advance for your help
  댓글 수: 8
Jorge Ignacio Cisneros Saldana
Jorge Ignacio Cisneros Saldana 2023년 5월 2일
Home->Preferences->General->Source I de-selected the Matlab default which was " *Enable MathWorks Source Control Integration" and select " none" instead.
/Applications/MATLAB_R2022a.app/bin/matlab
This both suggestions worked for me also running from terminal in my M1 MAX.
such a pitty to buy such expensive apple computer and being useless. I mentioned i am pursung a Phd and do lots of parallel processing.I contacted Apple support and they said it works with Matlab totally fine, even better than Intel so i went ahead. But I guess they were wrong.
Mathieu
Mathieu 2024년 11월 20일 18:52
이동: Walter Roberson 2024년 11월 20일 20:55
I have similar problem with an M3 chip and matlab 2024 a and b ... it's just so hard to use Matlab now, i just can't understand that.
None of the solution work...

댓글을 달려면 로그인하십시오.

답변 (10개)

appBotSmith59
appBotSmith59 2016년 6월 8일
Called MathWorks Tech Support this morning, 8 June 2016. With MatLab Tech-support trouble-shooting, my issue within R2016a was resolved by changing Matlab's default settings in Preferences as described for Mac OS 10x:
  • going to Home->Preferences->General->Source and
de-selecting the Matlab default which was " *Enable MathWorks Source Control Integration" and
selecting " *none" instead.
According to MathWorks Tech-Support Rep, MathWorks made the " Enable...Source Control" the default setting starting with the MatLab R2014b release. In my case, MatLab was trying to integrate with GIT which caused extended processing until the "Out-of-Memory" error.
  댓글 수: 4
Al in St. Louis
Al in St. Louis 2021년 4월 1일
This fixed my issue with R2021a.
Jinqi Liu
Jinqi Liu 2021년 8월 17일
Hi, do you know how to fix the error:
render process terminated: null
java.lang.NoSuchFieldError: TS_PROCESS_OOM
I have checked this error and it shows something to do with limited memory.

댓글을 달려면 로그인하십시오.


Hernan Gonzalez
Hernan Gonzalez 2018년 2월 9일
MATLAB R2017a, Mac version.
The solution for me was to increase java heap space: Preferences/General/Java Heap Memory
  댓글 수: 6
mats lindberg
mats lindberg 2022년 1월 12일
Worked for me on R2020b, windows
Bill Tubbs
Bill Tubbs 2022년 4월 2일
I increased the Java heap space from 128 to 2048 MB and it didn't solve the problem for me. Just takes even longer in the "busy" state before giving up. What levels are people choosing?

댓글을 달려면 로그인하십시오.


Mehdi Adibi
Mehdi Adibi 2019년 11월 13일
I have the same problem with 9.1.0.441655 (R2016b) on win10. I increased the Java memory heap to 384. Also Home->Preferences->General->Source I de-selected the Matlab default which was " *Enable MathWorks Source Control Integration" and select " none" instead. None worked for me and I can not work with matlab this way.
It is a shame such an expensive product is crap .. worthless.

afrazkhan34@gmail.com khilji
afrazkhan34@gmail.com khilji 2016년 1월 2일
hi arc lok!ur program crashes due to unresponsiveness of the program their could be many reasons try following methods. 1)if u use 64-bit windows then install 64 bit application else install 32 bit version of application. 2)if ur program was stable and now due to any reason it is try reinstalling application. 3)the also arises due using incompatible software version with matlab .Try using compatible compiler with matlab. if error still arises try the following link.hope this helps. Goodluck! http://javarevisited.blogspot.com/2011/09/javalangoutofmemoryerror-permgen-space.html

afrazkhan34@gmail.com khilji
afrazkhan34@gmail.com khilji 2016년 1월 5일
For executation of certain programs hving libraries from different languages like java u need a compiler. that compiler must b compatible with matlab use the "mex -setup" command to setup a compiler in matlab(in case u already hv any else download nd install the supported one set it up using above mentioned command nd follow the instructions.) The compatibility issue might b responsible fr memory dump. if the problem still persists then try changing the version of matlab u use as u mentioned"this error arrised in matlab 2015a" hope this works fr u!good luck!.

appBotSmith59
appBotSmith59 2016년 6월 8일
I encountered this error today [7 June 2016] using MatLab R2016a.
In the most recent past, I had a similar error in Android Studio which required increasing memory in a config file. Here's a link, http://lifeofcoding.com/2015/01/19/How-to-increase-Android-studio-memory-limit-in-Mac/. This worked for the Android Studio issue.
Does MathWorks have a recommended solution?
  댓글 수: 1
ahp ahp123
ahp ahp123 2017년 5월 1일
편집: Walter Roberson 2018년 2월 9일
I've faced with this problem too, I was using 2015a which after some while I faced with that and then installed 2016a but the error remains.
I changed the version of java that matlab used to 1.8. but the matlab doesn't work correctly.
I think support team should involve. actually I can't work with matlab now.
------------------------------------------------------------------------
std::terminate() detected at Fri Apr 14 09:22:26 2017
------------------------------------------------------------------------
Configuration:
Crash Decoding : Disabled
Crash Mode : continue (default)
Current Graphics Driver: NVIDIA Corporation GeForce GTX 960M/PCIe/SSE2 Version 4.5.0 NVIDIA 375.39
Current Visual : 0x6b (class 4, depth 24)
Default Encoding : UTF-8
GNU C Library : 2.23 stable
Host Name : ahp
MATLAB Architecture : glnxa64
MATLAB Root : /home/ahp/MatlabInstallationDirec
MATLAB Version : 8.6.0.267246 (R2015b)
OpenGL : hardware
Operating System : Linux 4.4.0-72-generic #93-Ubuntu SMP Fri Mar 31 14:07:41 UTC 2017 x86_64
Processor ID : x86 Family 6 Model 94 Stepping 3, GenuineIntel
Virtual Machine : Java 1.7.0_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
Window System : The X.Org Foundation (11804000), display :1
Fault Count: 1
Abnormal termination:
std::terminate()
Register State (captured):
RAX = 00007f63b4957460 RBX = 00007f63e6ebd888
RCX = 000000000000000a RDX = 00007f63e6eacb78
RSP = 00007f63b4957270 RBP = 00007f63b4957630
RSI = 0000000000000000 RDI = 00007f63b4957280
R8 = 0000000000000000 R9 = 00007f63ebd77740
R10 = 00007f63e6ad8588 R11 = 00007f63b49572f4
R12 = 00007f63e6ecd8c0 R13 = 00007f63b4958270
R14 = 00007f63b4958250 R15 = 00007f63b4958630
RIP = 00007f63e6bbbb0e EFL = 00007f63b4957488
CS = a94f FS = ec78 GS = 7f63
Stack Trace (captured):
[ 0] 0x00007f63e6bbbb0e /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwfl.so+00969486 _ZN2fl4diag5linux6x86_6412context_base12capture_dataEv+00000030
[ 1] 0x00007f63e6bb8fe4 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwfl.so+00958436
[ 2] 0x00007f63e25f0845 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwmcr.so+00784453
[ 3] 0x00007f63e25f2740 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwmcr.so+00792384
[ 4] 0x00007f63e25f2831 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwmcr.so+00792625
[ 5] 0x00007f63e25f2bb3 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwmcr.so+00793523
[ 6] 0x00007f63e25f2c23 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwmcr.so+00793635
[ 7] 0x00007f63eba8c376 /usr/lib/x86_64-linux-gnu/libstdc++.so.6+00586614
[ 8] 0x00007f63eba8c3c1 /usr/lib/x86_64-linux-gnu/libstdc++.so.6+00586689
[ 9] 0x00007f63eba8c5d9 /usr/lib/x86_64-linux-gnu/libstdc++.so.6+00587225
[ 10] 0x00007f63d5c50d6e /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwgui.so+00904558 _ZN11gui_objects11Rectangle2dC1Edddd+00000062
[ 11] 0x00007f63d5c1c2c1 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwgui.so+00688833 _ZN11gui_objects4font16PlainTextHandler21validateLogicalBoundsEv+00000737
[ 12] 0x00007f63d5c1c8de /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwgui.so+00690398 _ZN11gui_objects4font16PlainTextHandler16getLogicalBoundsEv+00000030
[ 13] 0x00007f6293d3fc2d /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwosgserver.so+02018349 _ZNK2hg14openscenegraph14OsgSceneServer27getTextLogicalBoundsBackEndERKN11gui_objects6CookieERKNS2_4font11StringPropsEbdRKNS6_11InterpreterESt6vectorINS2_11UTF16StringESaISE_EE+00000221
[ 14] 0x00007f6293d4aad5 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libmwosgserver.so+02063061 _ZN2hg19OsgSceneServerProxy28getTextLogicalBoundsCallbackEv+00000101
[ 15] 0x00007f63a661e844 /home/ahp/MatlabInstallationDirec/bin/glnxa64/libnativehg.so+00063556 Java_com_mathworks_hg_uij_TextBoundsRequestHandler_getTextLogicalBoundsCallback+00000020
[ 16] 0x00007f63bd012d98 <unknown-module>+00000000
[ 17] 0x00007f63bd006058 <unknown-module>+00000000
[ 18] 0x00007f63bd006058 <unknown-module>+00000000
[ 19] 0x00007f63bd006706 <unknown-module>+00000000
[ 20] 0x00007f63bd006706 <unknown-module>+00000000
[ 21] 0x00007f63bd0068e1 <unknown-module>+00000000
[ 22] 0x00007f63bd006233 <unknown-module>+00000000
[ 23] 0x00007f63bd006058 <unknown-module>+00000000
[ 24] 0x00007f63bd006058 <unknown-module>+00000000
[ 25] 0x00007f63bd0068e1 <unknown-module>+00000000
[ 26] 0x00007f63bd006058 <unknown-module>+00000000
[ 27] 0x00007f63bd56f758 <unknown-module>+00000000

댓글을 달려면 로그인하십시오.


Seyed Mostafa Mousavi Kahaki
Seyed Mostafa Mousavi Kahaki 2018년 5월 1일
On the Home tab, in the Environment section, click Preferences. Select MATLAB > General > Java Heap Memory. Select a Java heap size value using the slider or spin box. Note. ... Click OK. Restart MATLAB.
  댓글 수: 1
Olarewaju Richard
Olarewaju Richard 2024년 4월 9일
Thank you Seyed Mostafa Mousavi, your comment was helpful. God bless you

댓글을 달려면 로그인하십시오.


Alexandre3
Alexandre3 2019년 8월 6일
I had a similar problem when I passed from Matlab 2017b to Matlab 2018b. Specially when using Parallel Run, 2018b was freezing and then crashing. Then, I noticed that the default memory heap value was much higher than the one in 2017b. So, I decided to lower the heap memory in order to use the same as in the previous version (2017b). After that, everything worked just fine.
  댓글 수: 1
Furqan Hashim
Furqan Hashim 2021년 1월 7일
편집: Furqan Hashim 2021년 1월 7일
Is there a reason why reducing helped instead on increasing heap size?

댓글을 달려면 로그인하십시오.


kanika bhalla
kanika bhalla 2021년 6월 24일
I had similar problem and got solved by increasing the Java heap memory. Thank you all for all of your answers.

Lucky
Lucky 2022년 9월 13일
편집: Walter Roberson 2024년 11월 20일 20:55
List<String[]> csvBody = reader.readAll();.
This consumes a lot of info if you're reading a big file.
Instead, read each row individually and then write each one individually:
String[] strArray;
while ((strArray = reader.readNext()) != null) {
// ...
writer.writeNext(strArray);
}

카테고리

Help CenterFile Exchange에서 Call Web Services from MATLAB Using HTTP에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by