Optimizing memory leakage in JavaFX

后端 未结 2 1669
予麋鹿
予麋鹿 2020-11-27 08:34

I have written a piece of code, to make letters appear and fly as I write them. The problem it consumes a lot of memory.

I already optimized it a little bit by

相关标签:
2条回答
  • 2020-11-27 08:43

    The upgrade up to Mesa 13.0.4 does not fix the issue, but there is a workaround.

    If the program is run with -Dprism.order=j2d or -Dprism.order=sw VM argument, JavaFX rendering engine does not use OpenGL, and the leak does not happen. Of course, the application performance is significantly degraded in this case.

    0 讨论(0)
  • 2020-11-27 08:53

    There is a memory leak in JavaFX with Mesa >=11.0 (meaning any up to date Linux distribution). JavaFX developers say it's a bug in Mesa, but I couldn't find a bug report in Mesa (nor could I file one, as I don't know how to reproduce it outside of JavaFX).
    The only solutions as of now are -
    1. Use an older Linux (the key is having Mesa 10 or lower)
    2. Use an NVidia GPU - they have their own OpenGL implementation and don't rely on Mesa.
    3. Use Windows.

    Update (November 2016)
    This issue seems to have been resolved in newer versions of Mesa and/or X.org. Updating to Mesa 13.0 and X.org >=1.18.4 should solve this issue.

    Related links:

    • openjfx-dev discussion thread.
    • reddit discussion.
    • Mesa discussion.
    • Related SO post: JavaXF 8 ProgressBar and ProgressIndicator with process=-1 memory leak on Linux
    0 讨论(0)
提交回复
热议问题