Java exception occurred: java.lang.OutOfMemoryError: Java heap space
3 views (last 30 days)
Show older comments
After running for several hours, the matlab stopped running and displayed like below:
Error using icinterface/flushinput (line 42)
Java exception occurred:
java.lang.OutOfMemoryError: Java heap space
at
com.mathworks.toolbox.instrument.LineInputStream.readByte(LineInputStream.java:59)
at
com.mathworks.toolbox.instrument.LineInputStream.flush(LineInputStream.java:47)
at
com.mathworks.toolbox.instrument.SerialComm.hardwareFlushInput(SerialComm.java:644)
at
com.mathworks.toolbox.instrument.InstrumentReader.flushinput(InstrumentReader.java:154)
Error in GUI_Aging_of_capacitor>testCAP (line 575)
flushinput(serialport_LCR);
Error in GUI_Aging_of_capacitor>START_Callback (line 430)
testCAP(LCR,0,handles);
Error in gui_mainfcn (line 95)
feval(varargin{:});
Error in GUI_Aging_of_capacitor (line 42)
gui_mainfcn(gui_State, varargin{:});
Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)GUI_Aging_of_capacitor('START_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.
Thanks in advance for your help!!!
0 Comments
Answers (1)
Walter Roberson
on 3 Oct 2017
Looking around a bit, it appears to me that the Java class being used, LineInputStream, is for CR/LF delimited streams. The flush method is probably handled by reading the line and discarding that until there is no more current input. That would be a problem if you happened to hit upon a block of bytes that had no CR/LF in it: it appears it might possibly try to keep reading.
2 Comments
Walter Roberson
on 4 Oct 2017
If I am correct about the cause, then if for some reason a sufficiently large block with no CR/LF was present in the input stream, it would overfill any memory you might allocate. But perhaps it would be "good enough" for your purpose.
I cannot tell from what you posted what kind of device you are talking to (other than serial), or why you are talking to it. My speculation would be that you are doing a data transfer of some sort and you are losing synchronization.
What are the circumstances under which your program makes the flushinput() request?
See Also
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!