jankop wrote:Example from Marcel does not work for me.
What could be the reason it works for me but not for you? What does "does not work" mean anyway?
jankop wrote:I had to modify it a little.
And that's why it's running out of memory. I just quote the relevant lines:
jankop wrote:Code: Select allconn:on("receive", function(client, request)
...
conn:on("sent", function() client:close() print(node.heap()) end)
end)
--conn:on("sent", function() print(node.heap()) end)
The problem with your code is with closed upvalues. The on-receive callback function accesses the `conn` variable which was declared outside that callback function. It can, therefore, not be GCed. This is not the case in my example and thus my heap consumption is stable.