mirror of https://github.com/pulumi/pulumi.git
e82e0cbbcb
This fixes a defer leak that has been added during the review of #17461. Calling defer in a loop allocates memory (stack or heap depending on the Go version) and doesn't execute the deferred functions until the loop is over. In this case, since the loop runs forever, it would be even worse. This commit proposes as fix to simply remove the defer and move the close to its original place in the first iteration of the PR. This is safe to do since there are no retuns in-between. We could also refactor the loop to call instead writeMemoryProfile (as was suggested in the PR review). In that case, if the defer is inside writeMemoryProfile, then it can be safely called from the loop. More info about Go defer: https://victoriametrics.com/blog/defer-in-go/ |
||
---|---|---|
.. | ||
testdata | ||
args.go | ||
child_js.go | ||
child_unix.go | ||
child_windows.go | ||
console.go | ||
console_input.go | ||
console_input_js.go | ||
console_password.go | ||
console_test.go | ||
diag.go | ||
exit.go | ||
exit_test.go | ||
profile.go | ||
spinner.go | ||
stack.go | ||
term.go | ||
term_js.go | ||
term_test.go | ||
term_unix.go | ||
term_windows.go | ||
trace.go |