I have a long running UI app that appears to have a memory leak. I have a test run that has been going for almost a month. In the last couple of this has gone from using around 500MB to around 2GB as reported in Task Manager.
I realise that Task Manager is not the most accurate of reports so have also started VisualVM running and can see the baseline memory use increasing:
Following advice already in these forums (thanks to everyone!), I've downloaded Eclipse Memory Analyser and looked at a few Heap Dumps from Visual VM.
The Leak Suspects report seems to point in an obvious direction:
Problem Suspect 1
"The thread java.lang.Thread @ 0x701444f38 JavaFX Application Thread keeps local variables with total size 957,166,720 (68.16%) bytes.
The memory is accumulated in one instance of "java.lang.Thread", loaded by "<system class loader>", which occupies 957,166,720 (68.16%) bytes......"
Accumulated Objects by Class in Dominator Tree
These 111,2985 objects are all 'WebSocketException: RemoteEndpoint unavailable' errors. (full error: "java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]")
The app uses websockets to message other clients based on the WebSocket Based Push Framework tutorial & jWebSocketClient library.
With the current setup I'd expect about 10 push messages to be sent every minute or so.
I accept that the websocket will break and reconnect sometimes so am not necessarily surprised that errors are being generated (although this seems like a lot!), but should the errors be retaining so much RAM?
Many thanks in advance for the help.
I realise that Task Manager is not the most accurate of reports so have also started VisualVM running and can see the baseline memory use increasing:
Following advice already in these forums (thanks to everyone!), I've downloaded Eclipse Memory Analyser and looked at a few Heap Dumps from Visual VM.
The Leak Suspects report seems to point in an obvious direction:
Problem Suspect 1
"The thread java.lang.Thread @ 0x701444f38 JavaFX Application Thread keeps local variables with total size 957,166,720 (68.16%) bytes.
The memory is accumulated in one instance of "java.lang.Thread", loaded by "<system class loader>", which occupies 957,166,720 (68.16%) bytes......"
Accumulated Objects by Class in Dominator Tree
Label | Number of Objects | Used Heap Size | Retained Heap Size |
java.lang.RuntimeException First 10 of 111,298 objects | 111,298 | 4,451,920 | 957,158,848 |
These 111,2985 objects are all 'WebSocketException: RemoteEndpoint unavailable' errors. (full error: "java.lang.RuntimeException: java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.jetty.websocket.api.WebSocketException: RemoteEndpoint unavailable, current state [CLOSED], expecting [OPEN or CONNECTED]")
The app uses websockets to message other clients based on the WebSocket Based Push Framework tutorial & jWebSocketClient library.
With the current setup I'd expect about 10 push messages to be sent every minute or so.
I accept that the websocket will break and reconnect sometimes so am not necessarily surprised that errors are being generated (although this seems like a lot!), but should the errors be retaining so much RAM?
Many thanks in advance for the help.
Attachments
Last edited: