node-red/node-red-ui-nodes

UI-Table memory leak

Gonzo4 opened this issue · 5 comments

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:

  • Node-RED version: 1.0.6
  • node.js version: 10.17.0
  • npm version: 6.11.3
  • Platform/OS: Win 10
  • Browser: Firefox/Chrome/Edge

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)...

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

@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

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

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