This content has been marked as final. Show 2 replies
961911 wrote:No real idea: but this is an implementation detail, and you shouldn't rely on the implementation of code outside your control anyway. Even if you know what it does in the current version of FX, there's no guarantee it will stay the same in future versions. The updateItem method is called as and when needed in order to display the cells in the table.
The updateItem method of a cell value factory is called more than once for a particular row's cell(Single cell) when the tableview is rendered. Is this the expected behaviour or my cell factory class is wrong? Please let me know.
The reason why i am asking this question is, I am creating some objects inside the updateItem() method and since this method is called multiple times, these objects are created once again causing duplicates and leaks.It's fine to create objects in this method; it's probably sensible not to let references to them escape. As long as you don't do that (and even in some cases where you do), you wouldn't be creating a memory leak. Since the purpose of the updateItem(...) method is to change the item which the cell is currently displaying, I can't see any reason why you'd want to pass the reference to an object with a longer life cycle anyway.