Destroying tab content

2 posts, 0 answers
  1. Kai Schiffer
    Kai Schiffer avatar
    5 posts
    Member since:
    Feb 2010

    Posted 13 Sep 2012 Link to this post

    Hi folks,

    maybe my question is a bit un-kendoish but i am thinking about performance during the lifetime of an application. My users can open as many tabs as they wish and close them, too. When a tab is removed its elements are removed from the DOM. What happens to the event handlers attached to them? Are they automatically removed as well to allow garbage collection of the no-longer-pointed-to objects?

    Every time a tab is opened its page is downloaded and its 'code-behind' script is loaded into memory. In the Visual Studio Cassini you can see that these scripts are never unloaded from memory. Probably the objects created in the scripts will stay in the interpreter's scope forever, as they are interrelated with each other. What would be the best strategy to keep those leaks small? Putting as few code into these scripts as possible is probably a good idea, but what else? Delete everything by hand? Or is there any way to unload a script?

    All the best
    Kai 
  2. Kai Schiffer
    Kai Schiffer avatar
    5 posts
    Member since:
    Feb 2010

    Posted 14 Sep 2012 Link to this post

    Just read in the roadmap:
    Destroy() Method for all widgets

    All widgets will now provide a Destroy() method, which will completely remove all DOM elements created by a widget and its interactions. This is a key feature for enabling developers to build Single Page Applications (SPAs) with Kendo UI.


    This sounds promising, and yes, I am buiding a SPA. Will the destroy() of a tab recursively destroy all contained widgets?

    Greetings
    Kai

Back to Top