Skip to content
This repository was archived by the owner on Feb 2, 2025. It is now read-only.

How destroy memory in ajax angular datatables #1122

Closed
falinsin opened this issue Oct 26, 2017 · 1 comment
Closed

How destroy memory in ajax angular datatables #1122

falinsin opened this issue Oct 26, 2017 · 1 comment

Comments

@falinsin
Copy link

falinsin commented Oct 26, 2017

Starting with this example:

http://l-lin.github.io/angular-datatables/archives/#!/rerender
If rerender a lot of times this example and no memory leaks

** But in my version I use reloadData like this: **

$scope.dtOptionsMyTable = DTOptionsBuilder.newOptions()
.withOption('ajax', function(){........})
.withOption('createdRow', function (row, data, dataIndex) {
$compile(angular.element(row).contents())($scope);
})

And I do not know why we have an incresing use of leak memory. Garbage colector do not remove all.

How can I remove all these elements in memory?

I try this in every reload:

instanceTable.DataTable.clear();

Even we try to compile in another child object intead of this

$compile(angular.element(row).contents())($scope);
I try this in every reload

var newCreatedChildScope= $scope.$new(false); $compile(angular.element(row).contents())(newCreatedChildScope);

and then in every reload destroy the childscope this way

newCreatedChildScope.$destroy();
newCreatedChildScope=null;
Still a lot of memory leaks.

Are there a way using a instance.DataTable reference destroy a lot more about the table before reload data? I think this could be the solution

@l-lin
Copy link
Owner

l-lin commented Oct 28, 2017

Nice investigation.
Please keep it in a single thread: #1118.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants