matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
75 stars 173 forks source link

How to fix the insuffiencent memory #1111

Closed MadushaSammani closed 1 month ago

MadushaSammani commented 1 month ago

2024-05-07T15:37:13,289 ERROR MatsimRuntimeModifications$1:63 Getting uncaught Exception in Thread AWT-EventQueue-0 java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 1 at jogamp.opengl.windows.wgl.awt.WindowsAWTWGLGraphicsConfigurationFactory.chooseGraphicsConfigurationImpl(WindowsAWTWGLGraphicsConfigurationFactory.java:171) ~[jogl-all-2.4.0-matsim-1.jar:2.4.0-rc-20200306] at com.jogamp.nativewindow.GraphicsConfigurationFactory.chooseGraphicsConfiguration(GraphicsConfigurationFactory.java:424) ~[jogl-all-2.4.0-matsim-1.jar:2.4.0-rc-20200306] at com.jogamp.opengl.awt.GLCanvas.chooseGraphicsConfiguration(GLCanvas.java:1513) ~[jogl-all-2.4.0-matsim-1.jar:2.4.0-rc-20200306] at com.jogamp.opengl.awt.GLCanvas.addNotify(GLCanvas.java:609) ~[jogl-all-2.4.0-matsim-1.jar:2.4.0-rc-20200306] at java.awt.Container.addNotify(Container.java:2804) ~[?:?] at javax.swing.JComponent.addNotify(JComponent.java:4846) ~[?:?] at java.awt.Container.addNotify(Container.java:2804) ~[?:?] at javax.swing.JComponent.addNotify(JComponent.java:4846) ~[?:?] at java.awt.Container.addNotify(Container.java:2804) ~[?:?] at javax.swing.JComponent.addNotify(JComponent.java:4846) ~[?:?] at java.awt.Container.addNotify(Container.java:2804) ~[?:?] at javax.swing.JComponent.addNotify(JComponent.java:4846) ~[?:?] at javax.swing.JRootPane.addNotify(JRootPane.java:721) ~[?:?] at java.awt.Container.addNotify(Container.java:2804) ~[?:?] at java.awt.Window.addNotify(Window.java:791) ~[?:?] at java.awt.Frame.addNotify(Frame.java:495) ~[?:?] at java.awt.Window.pack(Window.java:829) ~[?:?] at org.matsim.vis.otfvis.OTFClientLive$1.run(OTFClientLive.java:104) ~[otfvis-15.0.jar:?] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318) ~[?:?] at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773) ~[?:?] at java.awt.EventQueue$4.run(EventQueue.java:720) ~[?:?] at java.awt.EventQueue$4.run(EventQueue.java:714) ~[?:?] at java.security.AccessController.doPrivileged(AccessController.java:400) ~[?:?] at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:87) ~[?:?] at java.awt.EventQueue.dispatchEvent(EventQueue.java:742) ~[?:?] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203) [?:?] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124) [?:?] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113) [?:?] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109) [?:?] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) [?:?] at java.awt.EventDispatchThread.run(EventDispatchThread.java:90) [?:?] 2024-05-07T15:38:09,266 INFO MemoryObserver:42 used RAM: 221 MB free: 127 MB total: 349 MB 2024-05-07T15:39:09,282 INFO MemoryObserver:42 used RAM: 221 MB free: 127 MB total: 349 MB In IntelliJ, under run-->run/debug configuration, I tried running the scenario with more RAM, but I still got the same error.

Screenshot 2024-05-07 154326

Could you please help me fix this error?

Janekdererste commented 1 month ago

The error looks like an issue with OTFVis on windows. Could you please share your logfile?

kainagel commented 1 month ago

This uses jogl-all-2.4.0-matsim-1.jar. In general, this does not work any more because "something changed". A sufficiently new version of matsim fixes this.

If you really need to use this older version of matsim, it may (or may not) work with a sufficiently old version of the JDK/JRE etc. This is, however, not supported by us, sorry.

https://github.com/matsim-org/matsim-libs/pull/2940

https://github.com/matsim-org/matsim-libs/pull/2945

MadushaSammani commented 1 month ago

Thank you very much for the help,

In IntelliJ, under the VM options of "Edit Configuration", I added the following text, and it works. **--add-exports java.base/java.lang=ALL-UNNAMED --add-exports java.desktop/sun.awt=ALL-UNNAMED --add-exports java.desktop/sun.java2d=ALL-UNNAMED**

kainagel commented 1 month ago

Glad to hear that. So it seems that we always need to add these VM options for the combination of "otfvis (or jogl)" and windows. And keep it in mind for other operating systems.

Added javadoc hint to OTFVisLiveModule. https://github.com/matsim-org/matsim-libs/pull/3262 .