fix: memory leaks when using go1.(N) with golangci-lint built with go1.(N-1) #5695
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
My previous PR #4938 was already detecting some cases, but in some contexts, this is not enough.
I was able to create the right context to reproduce the memory leak.
I analyzed the memory and found the root cause of the leak: the errors were accumulated for all the packages and all the files (stdlib, dependencies, project packages).
The number of errors was massive, consuming all the memory and CPU, and the OS ended up killing the process or dying.
I use a
panic
because the problem is detected inside the typechecking process (no control of the error management), and this process should be stopped as soon as possible.The new behavior