-
Notifications
You must be signed in to change notification settings - Fork 711
Solver: Fix space leak in 'addlinking' (issue #2899). #4110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a good idea IMO. |
If you want to merge this without the test I'm OK with that. |
9edc309
to
15e7de4
Compare
The solver creates linked nodes by copying existing unlinked nodes. Previously, the subtrees shared data, which caused a space leak. This commit combines the "build" and "addLinking" tree traversals so that the nodes are copied before they are expanded into full trees.
15e7de4
to
0f6dbce
Compare
Rebased onto master |
I think that this should also go in. |
Merged, thanks! |
Thanks! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The solver creates linked nodes by copying existing unlinked nodes. Previously,
the subtrees shared data, which caused a space leak. This commit combines the
"build" and "addLinking" tree traversals so that the nodes are copied before
they are expanded into full trees.
This should prevent sharing more reliably than my previous PR, #3530.
I'd like to add a regression test, but I'm not sure how to do it without significantly lengthening the build. I wrote a test with the solver DSL (grayjay@1f1b95d) that fails when I limit the heap size. Do you think we should add another test suite that we run with a limited heap? I can't add the test to the existing unit test suite, because some of the quickcheck tests already cause spikes in memory usage.
EDIT: The diff for the main commit isn't aligned well, so here is a diff with different options: https://rawgit.com/grayjay/9d842a8c8c1b04b1a1f0d8eca4a8a2ad/raw/467ffdf7b523272a5a7118f940af9e7f2634a0eb/cabal-pr-4110.html