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

Externally destroying a DataTable can lead to a memory leak #377

Closed
DataTables opened this issue Jul 13, 2015 · 5 comments
Closed

Externally destroying a DataTable can lead to a memory leak #377

DataTables opened this issue Jul 13, 2015 · 5 comments

Comments

@DataTables
Copy link

I've recently been looking into a memory leak issue for a DataTables user who makes use of your handy library (thanks for providing it!).

What appears to be happening is that the DataTable is being destroyed use the DataTables destroy() method, but then the data source that has been powering the DataTable data (from an ng-repeat) is updated. That is causing the DataTable to be reinitialised by this library and thus a leak occurs.

I've put an example together showing the issue. To reproduce, just start a profile in Chrome and then run the run() method in the console.

I've also put an example together that does not modify the data source after the DataTable has been destroyed and does not exhibit this issue.

As a possible fix, perhaps it would be possible to listen for the destroy.dt event from DataTables and when found, stop performing any updates to the DataTable. This would require an external destroy event to be distinguished from an internal one, as I see you use the destroy at lot internally.

@l-lin
Copy link
Owner

l-lin commented Jul 23, 2015

I see. Thanks for reporting it 👍

@l-lin l-lin added ready and removed ready labels Aug 17, 2015
@l-lin l-lin added this to the v0.5.0 milestone Aug 17, 2015
@l-lin
Copy link
Owner

l-lin commented Aug 31, 2015

I think it's resolved with #326.
As I'm quite new with profiling JS codes, can you point out where the leak is in the chrome profiling manager?
Because I can't see the difference between the one with the memory leak and the one without.

Using Chrome timeline, with leak:
leak
Without leak:
noleak

Is it the number of listeners?

Thanks!

@deifos
Copy link

deifos commented Nov 24, 2016

Any updates on this issue?

@l-lin
Copy link
Owner

l-lin commented Nov 27, 2016

Unfortunately, as Angular 2 is coming out, I lack the motivation to find the fix for this peculiar bug for the versions 0.X.X of angular-datatables... If some kind soul is willing to fix this... 😖

@l-lin
Copy link
Owner

l-lin commented Nov 25, 2017

Closing as issue is too old and the version is no longer maintained.

@l-lin l-lin closed this as completed Nov 25, 2017
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