This is a migrated thread and some comments may be shown as answers.

[Solved] Creating a kendo directive wrapper and memory leaks...

1 Answer 120 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Andrew
Top achievements
Rank 1
Andrew asked on 15 Oct 2014, 05:20 PM
Been at this for a bit so I'm looking for some outside help now.  The basic gist is we're using Kendo in our application but we want to create directive wrappers for each of the built in kendo directives that are provided.  This allows to override functionality and handle things how we want to in a more reusable format for our application.  That said, I am noticing some memory leak errors that I don't get when using the straight kendo-drop-down-list directive.  

The plunkr of this example can be accessed here:  http://plnkr.co/edit/SXhrkGbMnRRgDjI3v2kR?p=preview

The recreatable steps I've used is two create 2 new rows by clicking add row on the first two rows.  Click remove row on the second row twice to get back down to one row.  Take a heap snapshot in Chrome dev tools, repeat the process 2 more times, then do a comparison of objects allocated between Snapshot 1 and 2.  There is much more information still allocated and I'm kinda confused what could be holding it.

Example of the screen and leftovers can be found here too for comparison:  http://imgur.com/LcHhljq

I tried keeping a reference of the kendo-drop-down-list at one point and calling its method manually but got an error on this line of the destroy in kendo.all.js:

 that._arrow.off();

_arrow is undefined.  So I'm not sure if there's a recommended way to clean this up or this is just not supported but we really do need to have wrappers for the kendo directives to customize to our applications needs.

Any help would be great, thanks.

1 Answer, 1 is accepted

Sort by
0
Andrew
Top achievements
Rank 1
answered on 15 Oct 2014, 08:04 PM
I might have it figured out. In $scope.$on("$destroy", function(), I have to manually call the kendo's destroy method. I was running into problems with this originally because I was tracking ng-repeat by $index instead of a row.id value. Scopes were getting destroyed when new items were added in the middle of the table. I will write up a full answer in a bit if anyone is interested.
Tags
DropDownList
Asked by
Andrew
Top achievements
Rank 1
Answers by
Andrew
Top achievements
Rank 1
Share this question
or