We have noticed that trees with a large number of items (or deeply nested trees) consume a large amount of memory. We use external dataSources that are passed via the tree's options.
After the tree is destroyed, only a small amount of memory is freed. The rest stays allocated. Recreating the tree several times adds additional allocated memory that never becomes available again.
As far as we've seen, the dataSource itself does not offer a destroy() method or anything similar to free its resources. Is there anything we need to do to destroy the dataSource?
Hello, Michael,
You are correct that the Kendo UI DataSource does not provide a built-in destroy()
or disposal method to explicitly release its resources. This can result in memory not being fully reclaimed when destroying widgets like TreeView or TreeList that use external DataSources, especially with large or deeply nested data.
change
, requestStart
, etc.), manually unbind them before removing the DataSource:dataSource.unbind(); // Unbinds all event handlers
null
after destroying the widget and unbinding events:treeView.destroy();
dataSource.unbind();
dataSource = null;
If you need further optimization or have a specific scenario, please share more details about how your DataSource and widgets are managed in your application. I can then provide more targeted suggestions.
Regards,
Martin
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.