Improve memory efficiency by deleting Z3_context
on drop of Z3Solver
#11
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.
Description
Fixes some OOM (Out of Memory) issues when analyzing crates with a lot of entry points and/or deep call graphs causing errors of the form
Fixes # (issue)
These issues from the old repo are likely related/fixed:
facebookexperimental/MIRAI#1241
facebookexperimental/MIRAI#1257
Type of change
How Has This Been Tested?
This has been tested by running MIRAI's integration tests with the memory limit for Z3 set to 1 GB.
With the memory limit set, the test suite succeeds with this patch applied, while it exits unsuccessfully (with a
SIGSEGV
exit code on macOS) without this patch.Integration tests where run with:
One way to set the Z3 memory limit is to use the code snippet below in
Z3Solver::new
In some cases I've tested, this solves OOM issues for some analyses where memory usage exploded to as much as 32 GB, while the same analysis can complete with a memory limit as low as 512 MB with this patch applied (with 1 GB being sufficient typically).
Checklist:
main
.