OutOfMemoryError Java heap space Kryonet

63 views
Skip to first unread message

Lukas S

unread,
Jun 5, 2020, 9:09:27 AM6/5/20
to kryonet-users
Hey :)

Got following error:

Exception in thread "Client" Exception in thread "Client" 25:12 INFO: [kryonet] Connection 32 disconnected.Exception in thread "Client" Exception in thread "Client" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Client" java.lang.OutOfMemoryError: Java heap space
Exception in thread "Client" Exception in thread "Client" java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.iterator(Unknown Source)
    at sun.nio.ch.WindowsSelectorImpl.updateSelectedKeys(Unknown Source) 
    at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source) 
    at sun.nio.ch.SelectorImpl.select(Unknown Source)
    at com.esotericsoftware.kryonet.Client.update(Client.java:219) 
    at com.esotericsoftware.kryonet.Client.run(Client.java:333)
    at java.lang.Thread.run(Unknown Source)
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
java.lang.OutOfMemoryError: Java heap space
    at java.util.ArrayList.iterator(Unknown Source)
    at sun.nio.ch.WindowsSelectorImpl.updateSelectedKeys(Unknown Source) 
    at sun.nio.ch.WindowsSelectorImpl.doSelect(Unknown Source)
    at sun.nio.ch.SelectorImpl.lockAndDoSelect(Unknown Source) 
    at sun.nio.ch.SelectorImpl.select(Unknown Source)
    at com.esotericsoftware.kryonet.Client.update(Client.java:219) 
    at com.esotericsoftware.kryonet.Client.run(Client.java:333)
    at java.lang.Thread.run(Unknown Source)
java.lang.OutOfMemoryError: Java heap space
25:13 INFO: [kryonet] Connection 7 disconnected.

Does someone know why the Java heap gets filled up? Maybe something gets accumulated, but not sure.
Would be great if someone has a clue :) Thanks! 

Joachim Durchholz

unread,
Jun 7, 2020, 4:43:59 AM6/7/20
to kryone...@googlegroups.com
Hi Lukas,

you'll want to find out what's using up your heap space; the stack trace
is the wrong place to look at, you want a tool like VisualVM (sometimes
called JVisualVM).

For all we know, it could be a memory leak anywhere in your application.

If the data your deserialize originally had lots of shared objects, I
dimly recall that Kryonet may unshare them, and that could cause an
exponential size blowup, or even an infinite one if your data structure
has backlinks.
There was a discussion quite a while about about making Kryonet restore
sharing properties, but I believe it was rejected due to performance
reasons (I may be wrong).

Regards,
Jo

Am 05.06.20 um 15:09 schrieb Lukas S:
> --
> You received this message because you are subscribed to the
> "kryonet-users" group.
> http://groups.google.com/group/kryonet-users
> ---
> You received this message because you are subscribed to the Google
> Groups "kryonet-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to kryonet-user...@googlegroups.com
> <mailto:kryonet-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/kryonet-users/5d3ac1e3-fdc3-478c-8a40-afdf8d936d6do%40googlegroups.com
> <https://groups.google.com/d/msgid/kryonet-users/5d3ac1e3-fdc3-478c-8a40-afdf8d936d6do%40googlegroups.com?utm_medium=email&utm_source=footer>.

Lukas S

unread,
Jun 17, 2020, 11:58:20 AM6/17/20
to kryonet-users
Hi Jo,

thanks for your reply :) Highly appreciated! I had to think about it and then I found an accumulation of unprocessed data. 

Regards,
Lukas
Reply all
Reply to author
Forward
0 new messages