Create account / Log in

Out Of Memory Errors on Module Load.

Discussion area for the development team.

Moderators: uckelman, Tim M

Out Of Memory Errors on Module Load.

Postby JayTheGM » March 30th, 2021, 1:06 pm

Greetings folks, long time lurker first time needing to pop in.

So, I am trying to load up a module someone I know is working on to help troubleshoot something, the module loads fine but when I attempt to open it I get the following in the error-log.


Code: Select all
VASSAL.tools.logging.LoggedOutputStream -
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "AWT-EventQueue-0"


I tried increasing the JVM heap to 1024 and then I get a bit more info on the second try.

Code: Select all
2021-03-30 09:03:05,616 [25864-AWT-EventQueue-0] ERROR VASSAL.tools.ErrorDialog -
java.lang.OutOfMemoryError: Java heap space
   at java.base/java.util.Arrays.copyOf(Arrays.java:3480)
   at java.base/java.util.ArrayList.grow(ArrayList.java:237)
   at java.base/java.util.ArrayList.grow(ArrayList.java:244)
   at java.base/java.util.ArrayList.add(ArrayList.java:454)
   at java.base/java.util.ArrayList.add(ArrayList.java:467)
   at VASSAL.tools.KeyStrokeListener.addKeyStrokeSource(KeyStrokeListener.java:154)
   at VASSAL.build.GameModule.addKeyStrokeListenerNow(GameModule.java:1056)
   at VASSAL.build.GameModule.incorporateSourcesAndListeners(GameModule.java:1074)
   at VASSAL.build.GameModule.init(GameModule.java:1807)
   at VASSAL.launch.Player.launch(Player.java:88)
   at VASSAL.launch.Launcher$1.run(Launcher.java:86)
   at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:316)
   at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)
   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:721)
   at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:715)
   at java.base/java.security.AccessController.executePrivileged(AccessController.java:753)
   at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
   at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:85)
   at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:740)
   at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
   at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
   at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
   at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
   at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
2021-03-30 09:03:10,037 [25864-pool-3-thread-1] ERROR VASSAL.tools.ErrorDialog -
java.lang.reflect.InvocationTargetException: null
   at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1367)
   at java.desktop/java.awt.EventQueue.invokeAndWait(EventQueue.java:1342)
   at java.desktop/javax.swing.SwingUtilities.invokeAndWait(SwingUtilities.java:1480)
   at VASSAL.tools.DialogUtils.lambda$enqueue$0(DialogUtils.java:67)
   at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
   at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
   at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630)
   at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.OutOfMemoryError: Java heap space
   at java.desktop/sun.font.FontDesignMetrics.getSimpleBounds(FontDesignMetrics.java:537)
   at java.desktop/java.awt.Font.getStringBounds(Font.java:2606)
   at java.desktop/sun.swing.SwingUtilities2.getFontCharsWidth(SwingUtilities2.java:958)
   at java.desktop/sun.swing.SwingUtilities2.getFontCharWidth(SwingUtilities2.java:946)
   at java.desktop/javax.swing.text.Utilities.getTabbedTextOffset(Utilities.java:537)
   at java.desktop/javax.swing.text.GlyphPainter1.getBoundedPosition(GlyphPainter1.java:214)
   at java.desktop/javax.swing.text.GlyphView.getBreakWeight(GlyphView.java:715)
   at java.desktop/javax.swing.text.ParagraphView.findEdgeSpan(ParagraphView.java:754)
   at java.desktop/javax.swing.text.ParagraphView.calculateMinorAxisRequirements(ParagraphView.java:723)
   at java.desktop/javax.swing.text.BoxView.checkRequests(BoxView.java:936)
   at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:344)
   at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
   at java.desktop/javax.swing.text.FlowView.layout(FlowView.java:228)
   at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
   at java.desktop/javax.swing.text.BoxView.updateChildSizes(BoxView.java:367)
   at java.desktop/javax.swing.text.BoxView.setSpanOnAxis(BoxView.java:349)
   at java.desktop/javax.swing.text.BoxView.layout(BoxView.java:709)
   at java.desktop/javax.swing.text.BoxView.setSize(BoxView.java:398)
   at java.desktop/javax.swing.plaf.basic.BasicTextUI$RootView.setSize(BasicTextUI.java:1818)
   at java.desktop/javax.swing.plaf.basic.BasicTextUI.getPreferredSize(BasicTextUI.java:948)
   at java.desktop/javax.swing.JComponent.getPreferredSize(JComponent.java:1680)
   at java.desktop/javax.swing.JEditorPane.getPreferredSize(JEditorPane.java:1345)
   at VASSAL.tools.swing.FlowLabel.<init>(FlowLabel.java:96)
   at VASSAL.tools.swing.FlowLabel.<init>(FlowLabel.java:52)
   at VASSAL.tools.swing.Dialogs.buildContents(Dialogs.java:204)
   at VASSAL.tools.swing.Dialogs.showMessageDialog(Dialogs.java:77)
   at VASSAL.tools.swing.Dialogs.showMessageDialog(Dialogs.java:63)
   at VASSAL.tools.swing.Dialogs.showMessageDialog(Dialogs.java:51)
   at VASSAL.tools.ProblemDialog.lambda$show$0(ProblemDialog.java:103)
   at VASSAL.tools.ProblemDialog$$Lambda$399/0x00000001004e8858.run(Unknown Source)
   at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:306)
   at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:770)



Could someone please help me get some insight as to what's going on? Can I decompile this VMOD file to take a look?
JayTheGM
 
Posts: 1
Joined: March 30th, 2021, 12:58 pm

Re: Out Of Memory Errors on Module Load.

Postby jrwatts » March 31st, 2021, 1:27 am

Are you sure 1024 MB is actually enough? What setting is the module designer using for his JVM max heap? And the VMOD is simply a ZIP file with a custom extension. You can use any ZIP manipulation program to examine it. The actual VASSAL "code" is all in "buildFile" or "buildFile.xml", but not in a very human-readable format.
jrwatts
 
Posts: 334
Joined: April 29th, 2020, 10:30 pm

Re: Out Of Memory Errors on Module Load.

Postby uckelman » March 31st, 2021, 2:52 pm

Where can we get the module in order to have a look?
User avatar
uckelman
Site Admin
 
Posts: 9410
Joined: December 10th, 2007, 9:48 am
Location: Durham, England

Re: Out Of Memory Errors on Module Load.

Postby JoelCFC25 » March 31st, 2021, 11:53 pm

Joel, I think this the gentleman who asked me about the MegaMek module I gave you the link to the other day.
JoelCFC25
 
Posts: 812
Joined: October 12th, 2010, 5:15 pm
Location: Minnetrista, MN

Re: Out Of Memory Errors on Module Load.

Postby uckelman » April 1st, 2021, 12:21 am

Right.

The problem is that you have 2440 MapWidget elements in your buildFile.xml. Each one of those ends up corresponding to a GUI element. Even if that were loadable, it would be a usability disaster.

My advice is to take a step back and explain what you're trying to accomplish by doing this, because there may be a better approach which is workable.
User avatar
uckelman
Site Admin
 
Posts: 9410
Joined: December 10th, 2007, 9:48 am
Location: Durham, England


Return to Developers

Who is online

Users browsing this forum: No registered users and 3 guests