ngx-datatable not getting garbage collected

Created on 19 Sep 2017  路  4Comments  路  Source: swimlane/ngx-datatable

I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, post on Stackoverflow or Gitter

Current behavior

ngx-datatable and its parent component are not ever garbage collected after navigating away to another component, causing a memory leak.

Reproduction of the problem

Add a simple ngx-datatable to some component's template:

<ngx-datatable [rows]="[]" [columns]="[]"></ngx-datatable>

Then navigate away to another route, so that the component is no longer visible.

In the memory tab of the Chrome Dev Tools take a heap snapshot - the component with the ngx-datatable never gets garbage collected.

If I remove ngx-datatable from the component template, then the component does get garbage collected as expected.

  • Table version: 9.3.1

  • Angular version: 4.3.6

  • Browser: Chrome 60

Most helpful comment

I still have the same problem

  • Angular version: 7.x
  • Table version: 14.x
  • Browser: Chrome 70

All 4 comments

@will093 can you provide a plunker with the routing you are using?

@wizarrc I tried and failed to reproduce in the following Plunker which replicates the routing for the section of my application with the datatable:

https://plnkr.co/edit/uckO2V?p=info

I think the problem is related to the routing though, because if I load the component containing the datatable at a different place in the route hierarchy, it gets cleaned up as expected.

@will093 that's what I was thinking. There were some memory leaks that I fixed in the past, but never the whole thing, which leads me to believe it's a routing or another directive that's holding a reference thus not allowing garbage collection. If you notice part of the table not getting collected, it might be the table that has the leak.

I still have the same problem

  • Angular version: 7.x
  • Table version: 14.x
  • Browser: Chrome 70
Was this page helpful?
0 / 5 - 0 ratings