Repository navigation
fix(server): subscription memory leak - #6161
Conversation
|
This PR was not deployed automatically as @oleasteo does not have access to the Railway project. In order to get automatic PR deploys, please add @oleasteo to the project inside the project settings page. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| // free up references for garbage collection | ||
| next = null; |
There was a problem hiding this comment.
This is set on next iteration.... suuurely it's not needed
| // free up references for garbage collection | |
| next = null; |
There was a problem hiding this comment.
this one should be removable thoughhh
| } | ||
|
|
||
| const result: TRPCResultMessage<unknown>['result'] = { | ||
| result = { |
There was a problem hiding this comment.
This looks unnecessary - if it's in the loop instead it should be GC'd, no?
There was a problem hiding this comment.
I see your comment "We need those declarations outside the loop for garbage collection reasons."
can you explain why?
it's within a closure... it should be freed automatically?
There was a problem hiding this comment.
Unfortunately, no. I thought so, too. Until I had those test cases proving me wrong.
I mentioned this in nodejs/node#55585. It seems like a const xyz = ... inside a loop is not freed up at the end of the closure, but only when the same statement is reached again. I assume this to be some v8 optimization or bug. Maybe the node devs will tell me within that issue I opened on their side.
There was a problem hiding this comment.
Those cases are not as severe as the original reported issue, but still we'd have a dangling reference to the latest value. Seems to be a pretty easy error to have in nodejs, as even a yield* does have this issue itself xD
|
This pull request has been locked because we are very unlikely to see comments on closed issues. If you think, this PR is still necessary, create a new one with the same branch. Thank you. |
Closes #6156