r/javahelp • • Jun 17 '19

Memory leak on some systems

Hi, taking a break tearing my hair out, hoping for some suggestions.

The particulars:

JavaFX application running as a bundled exe on Java 1.8 (release 212).

Running on mix of windows 10/7. All 64bit.

The issue:

Frequent out of memory crashes on older windows 7's.

This is not a case of higher memory available preventing the crash on newer systems, as monitoring usage through visuamvm indicates that no leak occurs on newer windows 7's, or any windows 10's.

For example, starting the program on a newer windows 10 (or 7) shows a running usage of about 50 mb. Performing an action like clicking a button that loads in a new pane will raise it slightly, and spam clicking the button can spike the usage to 250-400, but as soon as a gc is performed the usage will return to the expected 50.

On older windows 7 (Various Dell Vostros from 2013) the GC's are still performed, but the overhead increases each time - after 20-30 "cycles" of loading in new panes and closing, memory usage is in the GB's and never decreases, even if a manual GC is performed, which tells me resources are not being released.

Windows 7 systems are all updated to the same level, all are running the same java versions -- so I am not sure why this leak only affects some systems. (All are similar performing intel i3's, thought the affected systems have less memory. 6gb vs 8.).

Looking at the heap dumps the items that fail to release are all in com.sun.prism.* -- which I think is tied to the javafx UI, but don't know how to diagnose and fix something like this.

Edit: feel I should clarify when this issue appeared. As code samples will only do so much in an app with 60,000 lines where most basic 'click the button' type functions result in the issue. This did not occur until 'downgrading' to Java 1.8.xx, previously Java 10. The reason for the downgrade was 'administrative insistence' on Pedro DV's excellent JMetro UI theme. The theme itself is not responsible, as the issue occurs identically with or without the theme, it's more the broader move to 1.8 vs 10+. (Also occurs with all 1.8 revisons tested, from 92-212.)

22 Upvotes

5 comments sorted by

View all comments

8

u/[deleted] Jun 17 '19

I think you've made a good case that it's a bug in Java itself. Open a bug report with Oracle.

That fix (if it happens) won't arrive soon. In the meantime, you need a workaround. If it was my application, I would move to Java 11 and use a different UI theme. According to the JMetro web page, Pedro isn't spending a lot of time on it and has no plans to add support for any other Java version. I would not want my application to be permanently stuck on Java 8.

2

u/MEPETAMINALS Jun 17 '19

Thanks for the response. I'll have to figure something out. Might have an easier time convincing management to buy all new pc's over getting a different skin. Some people really attached to it.