Why am i receiving "Error using publish Java exception occurred: java.lang.OutOfMemoryError: GC overhead limit exceeded"?
6 views (last 30 days)
Show older comments
Mackenzie Weeks
on 19 Jan 2021
Commented: Mackenzie Weeks
on 6 May 2021
I have increased the java heap space and I'm still getting the same error
% Program to Fill Reservoir 1/19/20
%General Data
G = 32.2
%Problem Specific Data
Simtime = 9000;
Area = 358098; %ft^2
HMAX = 6 %ft
%Time Step
N = 1000; %start with 100 then go up to make it work
DT = Simtime/(N-1);
%Initial Conditions
K = 1;
Time(K) = 0;
S(K) = 0;
H(K) = 0; %depth at beginning
QI(K) = 0; %Q inlet in the beginning
%Simulation
for K = 1:N-1;
Time(K+1) = Time(K)+DT; %time at the second node
QI(K+1) = (750/pi)*(1-cos(pi*Time(K+1)/4500));
S(K+1) = S(K)+ DT*((QI(K)+QI(K+1))/(2));
H(K+1) = S(K+1)/Area
end
%Plots/ Animations
figure(1)
plot(Time,S);
xlabel('Time (s)');
ylabel('Storage');
title ('Reservoir Filling Storage vs. Time')
figure(2)
plot(Time,H);
xlabel('Time (s)');
ylabel('Depth (ft)');
title ('Reservoir Filling Depth vs Time')
%Program for Reservoir Emptying
%Implementation
Cd = .65; %discharge coefficient
d = 2; %ft
a = (pi)*(d^2); %cross sectional area
Term = Cd*a*sqrt(2*G);
%Initial Conditions
K = 1;
Time(K) = 0;
S(K)= S(N); %no longer 0 (2,148,090)
H(K) = H(N); %max height in previous simulation
%Simulation
while S(K)>0; %as long as storage is greater than zero
Time(K+1) = Time(K)+DT;
S(K+1) = S(K)-(Term*sqrt(H(K))*DT);
H(K+1) = S(K)/Area;
K = (K+1);
end
%Plots/ Animations
figure(3)
plot(Time,S);
xlabel('Time (s)');
ylabel('Storage');
title ('Reservoir Emptying Storage vs. Time')
figure(4)
plot(Time,H);
xlabel('Time (s)');
ylabel('Depth (ft)');
title ('Reservoir Emptying Depth vs Time')
publish('ECI144_Exercise2.m','pdf')
Error using publish
Java exception occurred:
java.lang.OutOfMemoryError: GC overhead limit exceeded
at org.apache.fop.layoutmgr.KnuthSequence.wrapPositions(KnuthSequence.java:129)
at org.apache.fop.layoutmgr.inline.InlineLayoutManager.getNextKnuthElements(InlineLayoutManager.java:346)
at org.apache.fop.layoutmgr.inline.LineLayoutManager.collectInlineKnuthElements(LineLayoutManager.java:708)
at org.apache.fop.layoutmgr.inline.LineLayoutManager.getNextKnuthElements(LineLayoutManager.java:634)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:145)
at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:293)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:107)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextChildElements(BlockLayoutManager.java:145)
at org.apache.fop.layoutmgr.BlockStackingLayoutManager.getNextKnuthElements(BlockStackingLayoutManager.java:293)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:115)
at org.apache.fop.layoutmgr.BlockLayoutManager.getNextKnuthElements(BlockLayoutManager.java:107)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextChildElements(FlowLayoutManager.java:223)
at org.apache.fop.layoutmgr.FlowLayoutManager.addChildElements(FlowLayoutManager.java:148)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:116)
at org.apache.fop.layoutmgr.FlowLayoutManager.getNextKnuthElements(FlowLayoutManager.java:69)
at org.apache.fop.layoutmgr.PageBreaker.getNextKnuthElements(PageBreaker.java:251)
at org.apache.fop.layoutmgr.AbstractBreaker.getNextBlockList(AbstractBreaker.java:770)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:178)
at org.apache.fop.layoutmgr.PageBreaker.getNextBlockList(PageBreaker.java:158)
at org.apache.fop.layoutmgr.AbstractBreaker.doLayout(AbstractBreaker.java:389)
at org.apache.fop.layoutmgr.PageBreaker.doLayout(PageBreaker.java:112)
at org.apache.fop.layoutmgr.PageSequenceLayoutManager.activateLayout(PageSequenceLayoutManager.java:143)
at org.apache.fop.area.AreaTreeHandler.endPageSequence(AreaTreeHandler.java:267)
at org.apache.fop.fo.pagination.PageSequence.endOfNode(PageSequence.java:139)
at org.apache.fop.fo.FOTreeBuilder$MainFOHandler.endElement(FOTreeBuilder.java:362)
at org.apache.fop.fo.FOTreeBuilder.endElement(FOTreeBuilder.java:190)
at com.icl.saxon.output.ContentHandlerProxy.endElement(ContentHandlerProxy.java:147)
at com.icl.saxon.output.ProxyEmitter.endElement(ProxyEmitter.java:90)
at com.icl.saxon.output.NamespaceEmitter.endElement(NamespaceEmitter.java:150)
at com.icl.saxon.output.GeneralOutputter.writeEndTag(GeneralOutputter.java:698)
at com.icl.saxon.style.LiteralResultElement.process(LiteralResultElement.java:294)
Exception in thread "Explorer NavigationContext request queue": java.lang.OutOfMemoryError: GC overhead limit exceeded
at java.util.HashMap.newNode(HashMap.java:1750)
at java.util.HashMap.putVal(HashMap.java:631)
at java.util.HashMap.put(HashMap.java:612)
at java.util.HashSet.add(HashSet.java:220)
at java.util.AbstractCollection.addAll(AbstractCollection.java:344)
at java.util.HashSet.<init>(HashSet.java:120)
at com.mathworks.mlwidgets.explorer.model.editorfs.EditorFileSystem.getCompleteSetOfFilesAndFolders(EditorFileSystem.java:311)
at com.mathworks.mlwidgets.explorer.model.editorfs.EditorFileSystem.exists(EditorFileSystem.java:130)
at com.mathworks.mlwidgets.explorer.model.editorfs.EditorFileSystem.isDirty(EditorFileSystem.java:280)
at com.mathworks.mlwidgets.explorer.model.editorfs.EditorFileSystem$2.accept(EditorFileSystem.java:321)
at com.mathworks.mlwidgets.explorer.model.editorfs.EditorFileSystem$2.accept(EditorFileSystem.java:317)
at com.mathworks.mlwidgets.explorer.model.overlayfs.OverlayFileSystem.toExternalEntry(OverlayFileSystem.java:102)
at com.mathworks.mlwidgets.explorer.model.overlayfs.OverlayFileList$1.convert(OverlayFileList.java:91)
at com.mathworks.mlwidgets.explorer.model.overlayfs.OverlayFileList$1.convert(OverlayFileList.java:87)
at com.mathworks.util.AsyncReceiverUtils$3.receive(AsyncReceiverUtils.java:76)
at com.mathworks.mlwidgets.explorer.model.realfs.StatToEntryAdapter.receive(StatToEntryAdapter.java:40)
at com.mathworks.cfbutils.NativeCfb.listFiles(Native Method)
at com.mathworks.mlwidgets.explorer.model.realfs.RealFileList.readFilesAndFolders(RealFileList.java:47)
at com.mathworks.mlwidgets.explorer.model.overlayfs.OverlayFileList.readFilesAndFolders(OverlayFileList.java:52)
at com.mathworks.mlwidgets.explorer.model.vfs.VirtualFileList.readFilesAndFolders(VirtualFileList.java:57)
at com.mathworks.mlwidgets.explorer.model.table.UiFileList.readAndUpdateCache(UiFileList.java:364)
at com.mathworks.mlwidgets.explorer.model.table.UiFileList.access$500(UiFileList.java:45)
at com.mathworks.mlwidgets.explorer.model.table.UiFileList$6.run(UiFileList.java:325)
at com.mathworks.util.RequestQueue.execute(RequestQueue.java:129)
at com.mathworks.util.RequestQueue.access$000(RequestQueue.java:25)
at com.mathworks.util.RequestQueue$2.run(RequestQueue.java:79)
at java.lang.Thread.run(Thread.java:748)
0 Comments
Accepted Answer
Suryaansh Mata
on 18 Feb 2021
As a starting point, I suspect the PDF that you are trying to generate in this case requires more Java memory than is available because it is a large file. In order to generate this PDF, try increasing the Java heap space. This can be done by editing the setting in Preferences > General > Java Heap Memory. Hopefully the error should resolve by increasing the Java Heap Size from 768 MB to 1,296 MB.
However since you mention that increasing the same did not work out, you may try the following steps -:
Please try the following:
1) Disable the Source Integration Tool:
- Home Tab > Environment > Preferences
- In the preferences dialog, MATLAB > General > Source Control pane, then select None
- Close MATLAB
2) If you have a java.opts file (usually in matlabroot/bin/arch), the file should contain only the following lines:
- XX:-UseGCOverheadLimit
- Xmx1024m
3) If applicable, please unset the JAVA_OPTIONS and JAVA_TOOL_OPTIONS in the ~/.bashrc or ~/.bash_profile files
DISCLAIMER: These are my own views and in no way depict those of MathWorks.
More Answers (0)
See Also
Categories
Find more on Java Package Integration 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!