Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory Leak since scope is retained #1118

Closed
cesterlizi opened this issue Oct 23, 2017 · 1 comment
Closed

Memory Leak since scope is retained #1118

cesterlizi opened this issue Oct 23, 2017 · 1 comment
Milestone

Comments

@cesterlizi
Copy link

What versions you are using?

  • node version: v6.9.2
  • npm version: 3.10.9
  • angular version: 1.6.1
  • jquery version: v3.1.1
  • datatables version: 1.10.12
  • angular-datatables version: 0.6.3-dev (last commit on angular 1)
  • angular-cli version:

What's the problem?

I strongly use angular-datatables on my application and I've notice that I was leaking memory due angular-datatables directive.
I've done some memory tests using chrome dev tools on app examples provided, and I've found that is leaking memory. I seems that scope is retained. Please check the screenshot

memory_profile_dt

Can you share your code?

I've only added a tag to the scope in oder to identify if it retained and not elegible for GC ( garbage collector) as recommended on this post http://www.dwmkerr.com/fixing-memory-leaks-in-angularjs-applications/

    //  Create a class, assign it to the scope. This'll help us
    //  see if $scope is leaked.
    function AngularWayCtrlTag() {}
    vm.__tag = new AngularWayCtrlTag();

I've also made the same tests for angular v2 and is also leaking memory

Regards.
Carlos

@l-lin
Copy link
Owner

l-lin commented Oct 28, 2017

With Angular, it's more straight forward: when destroying the directive, the DataTable must also be destroyed.

With AngularJS, it's a bit more complicated. We need to destroy the DataTables, but we also need to remove the $scope...

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

No branches or pull requests

2 participants