XCharts-Team/XCharts

The TooltipHandler creates GC garbage every frame

Closed this issue · 0 comments

The commit 0990b11 introduced a regression in which the TooltipHandler makes GC Allocations every frame:

In the case where the pointer is not in the chart, both calls to ListPool<Serie>.Get() inside the function UpdateTooltipData are executed. And because the pointer is not in the chart, m_ShowTooltip is set to false in the last else clause. This makes UpdateTooltip to skip all logic and miss the chance to release the list back to the pool.

The pull request #311 tries to fix this problem.

This also make the tooltip to work again for PieCharts. The only issue that remains is that the tooltip will continue to update it's data for a PieChart even when the TriggerOn is set to Click.

Also, maybe it would be a good idea to trigger a log after a pool reaches a certain countActive/countAll big value to warn the user that there might be a problem somewhere in the code, like not releasing the object back to the pool.

Screenshot_24
Screenshot_25