JavaFX unexplainable leaks memory on Linux

2019-02-27 20:49发布

My Java program leaks memory while operating on Linux exclusively.

Symptoms:

  • VisualVM shows heap size about 300Mb tops and no suspicious activity.
  • On Mac OS X the program runs indefinitely with 900Mb of memory (via Activity Monitor)
  • On Linux the memory footprint quickly increases up to 4.5Gb when OS runs out of memory (via Activity Monitor)

The program uses JavaFX. This behaviour started after a commit which separated GUI and calculations into different threads.

This can't be a leak in the JVM, can it?

Are there any tools to investigate such problems?

1条回答
一纸荒年 Trace。
2楼-- · 2019-02-27 21:10

Various memory leak bugs have been reported against JavaFX. They are related to use of hardware accelerated graphics. The "head" issue is this:

The comments on the above suggest that the bugs may be in the OpenGL implementation, but they are triggered by something JavaFX is doing. Your observation about your commit seems cogent, and it may be worth reporting this to Oracle.

On the other hand, the fact that the reported bugs are related to graphic acceleration suggests that you may be able to work around your problem by telling Java not to use graphics acceleration.

Are there any tools to investigate such problems?

None that I know of. If the problem is where people think it is, then your best bet is to work around it.

查看更多
登录 后发表回答