node-red / node-red-ui-nodes

Additional nodes for Node-RED Dashboard
Apache License 2.0
117 stars 81 forks source link

UI-Table memory leak #49

Closed Gonzo4 closed 3 years ago

Gonzo4 commented 3 years ago

Which node are you reporting an issue on?

UI-Table 0.3.7

What are the steps to reproduce?

Just put the table node and the inject node on the flow, connect both and inject some random data in a short interval. Now watch the memory consumption of the browser tab (debugger - normally F12) which will continuously increase until the browser get slow ;)

What happens?

Memory consumption increases constant over time

What do you expect to happen?

Stable memory usage...

Please tell us about your environment:

Gonzo4 commented 3 years ago

I have played around, destroying an already existing table will maybe solve the problem. I have inserted the following lines to the node.js before a new table is created (between line 202 and 203):

// console.log("createTabulator",opts);
if($scope.table !== undefined)
    $scope.table.destroy();
$scope.table = new Tabulator(basediv, opts);

The memory consumption doesn't increase now, but I have no clue if there are any side effects (my javascript skills are very basic)...

dceejay commented 3 years ago

@Christian-Me - Would seem sensible to ensure removal before creating anything "new" - but... - care to comment ?

Christian-Me commented 3 years ago

@dceejay To me too ... @Gonzo4 Thank you for spotting that problem. I don't expect any side effects ... Will include your suggestion and do some tests with my quite heavy tables

dceejay commented 3 years ago

@Christian-Me - great - will let you PR it when you are happy.

Christian-Me commented 3 years ago

Interesting ... I thought the GC would kick in and get rid of the unreferenced tabulator tables ... Have to learn more how the GC work. I didn't had that problem because I used commands to update / fill my tables

Fun using a profiler again, last used "Turbo Profiler" form Borland decades ago ;)

@dceejay Think I'm happy