- Bearbeitet
Gloomhaven Helper App Memory Leak
Greetings,
I have been using the Gloomhaven app on four devices:
PC as server (desktop app), one Tablet (desktop app) and two mobile phones (Android app) as clients.
After a while the app on the server crashes with below exempt from the error log:
Exception in thread "main" com.badlogic.gdx.utils.GdxRuntimeException: java.lang.OutOfMemoryError: Java heap space
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:123)
at com.esotericsoftware.gloomhavenhelper.GloomhavenHelperDesktop.main(GloomhavenHelperDesktop.java:52)
Caused by: java.lang.OutOfMemoryError: Java heap space
at com.badlogic.gdx.utils.StringBuilder.<init>(StringBuilder.java:62)
at com.badlogic.gdx.scenes.scene2d.ui.Label.<init>(Label.java:41)
at com.badlogic.gdx.scenes.scene2d.ui.Label.<init>(Label.java:64)
at com.esotericsoftware.gloomhavenhelper.MonsterBoxMenu.layoutUI(MonsterBoxMenu.java:139)
at com.esotericsoftware.gloomhavenhelper.MonsterBoxMenu.<init>(MonsterBoxMenu.java:58)
at com.esotericsoftware.gloomhavenhelper.MonsterBox.create(MonsterBox.java:70)
at com.esotericsoftware.gloomhavenhelper.MonsterBox.<init>(MonsterBox.java:59)
at com.esotericsoftware.gloomhavenhelper.util.Serialization.readRow(Serialization.java:267)
at com.esotericsoftware.gloomhavenhelper.util.Serialization.readPlayerRow(Serialization.java:181)
at com.esotericsoftware.gloomhavenhelper.util.Serialization.read(Serialization.java:131)
at com.esotericsoftware.gloomhavenhelper.Game.loadState(Game.java:108)
at com.esotericsoftware.gloomhavenhelper.network.Network.loadState(Network.java:126)
at com.esotericsoftware.gloomhavenhelper.network.GameServer$7.run(GameServer.java:137)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.loop(Lwjgl3Application.java:157)
at com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application.<init>(Lwjgl3Application.java:117)
... 1 more
I'd use the tablet as server, yet somehow the mobile devices cannot connect to it. The mobile devices tend to shutdown the app rather often so none of them can be properly used as server.
Still looking for a way out here.
Is there any way this can be fixed?
Thank you for your efforts!
I haven't see this happening. I'd need to reproduce it to see what is taking up so much memory. Do you have step-by-step instructions that cause it to happen every time?
As a stopgap you can run using eg -Xmx4096m
like this:
java -Xmx4096m -jar GloomhavenHelper.jar
That allows GHH to use 4096MB (4GB) of RAM. You can use larger numbers if you like. Also I suggest using Java 16 to run it, which you can get here:
https://jdk.java.net/16/
It shouldn't be crashing on the phones either. You might try rebooting the device before a gaming session.
Hello Nate and thank you very much for your quick reply.
I had already edited the run.sh file to include the following:
java -XstartOnFirstThread -jar ghh.jar -Xms24576m -Xmx24576m
Yet the server application still crashed without a message two days ago after having played for a few hours.
In general, I just start the desktop application on the server and then the server is idling (not in energy saving mode) while the main active device is the tablet. Mobile devices are only used to enter initiative.
The log from two weeks ago is attached to this post. In it you will find:
192.168.0.55 as the desktop PC
192.168.0.97 tablet
192.168.0.100 mobile device A
192.168.0.123 mobile device B
I will update to Java 16, see how it goes and give feedback.
Thank you!
Hmm, very strange. I will try leaving a server running a long time.
Happened again today. Server application crashed on the destktop PC after about four hours. Log attached.
Sadly, I didn't manage to figure out how I could activate Java 16 as my Java still seems to run on Java 8 despite me configuring it to use 16, but I am not savvy enough for Java settings.
Figured out why the mobiles didn't connect to the tablet as server though. Will try using that one as server next time.
To run 16 download it, unzip, and in the bin folder there is a java.exe
. Use a path to that java.exe
instead of just typing java
.
Please try running like this:
C:\your\path\to\java16\bin\java.exe
---
XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=C:\some\path\dump.bin Xmx1024m -jar GloomhavenHelper.jar
Change the paths as needed, but keep the parameter for 1024MB. The next time you get an out of memory error, Java will create a file at C:\some\path\dump.bin
(change the path to a folder that exists and where Java can write, eg your desktop). Please send that file and we'll be able to figure out where the memory leak is. It may be large, so you might need to use a file upload site. You can email us the link if you like: contact@esotericsoftware.com
Your advice with Java 16 seems to have worked. 515 minutes and no crash leaving the app running on the desktop PC. We used the tablet anyways, but thank you very much for your efforts on this issue!
Great! I'm a little surprised, but that's good news!
Already have java 18 but this problem has not yet been solved.
I haven't been able to reproduce a memory leak. You can run with -Xmx4096m
or higher.