JavaFX passes memory through dirtynodes

I have a javafx desktop application that, after some time of use, accumulates many objects in dirtynodes [] in one of the episodes. The Eclipse MAT tool recognized this as a suspicious situation and a possible leak. It uses 170 MB of memory, which in my case is 30%. Periodic updates of nodes in this scene. Is there anything I can do about it? Are these dirty guys cleaning up? I am using java 8 u 51.

+5
source share
1 answer

Dirty nodes are nodes in the scene that have been declared invalid. They are processed once for each frame, so if the JavaFX Application Thread (user interface thread) is busy, then synchronization of dirty nodes cannot occur.

We had a problem on the list screen, in which each cell of the list contained many rectangles and texts. The entire list contained several hundred nodes.
Cells in a listview should not be reused, but must be created each time the list is redrawn. When there were a lot of lines in the list, and the user held the scroll bar and moved it for a minute, synchronization of dirty nodes could not occur, and we selected an exception from memory, because there were hundreds of dirty nodes for business cards.

So my suggestion is to check if you block Application Application Thread when adding nodes to it.

It is good practice to create nodes in the background thread and add this scene to the user interface thread.

0
source

All Articles