tests: harden memory leak check in test_siblings_without_eval#3088
Open
booxter wants to merge 1 commit intoml-explore:mainfrom
Open
tests: harden memory leak check in test_siblings_without_eval#3088booxter wants to merge 1 commit intoml-explore:mainfrom
booxter wants to merge 1 commit intoml-explore:mainfrom
Conversation
d0ce761 to
5413e30
Compare
Author
|
Looks like I broke something that was not present before I rebased to master. Will fix. |
When running the test suite on darwin as part of nixpkgs package build,
we often hit the following error:
```
> mx.synchronize()
> t()
> gc.collect()
> expected = get_mem()
> for _ in range(100):
> t()
> used = get_mem()
> > self.assertEqual(expected, used)
> E AssertionError: 273678336 != 273694720
```
You can find an example of the full failure log here:
https://hydra.nixos.org/build/320731525
The difference between actual and expected is 16k (one page size on
aarch64-darwin).
The test seems brittle as it depends on *peak* memory, not real memory
at the moment of measurement, so anything during the run of the process
that could push the allocator to allocate another page can break the
test.
This patch switches the test case to measure real memory using psutil on
all platforms. It also makes sure that macos CI installs psutil (via
.[dev] dependency group).
Signed-off-by: Ihar Hrachyshka <ihar.hrachyshka@gmail.com>
5413e30 to
cbfc301
Compare
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
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.
When running the test suite on darwin as part of nixpkgs package build,
we often hit the following error:
You can find an example of the full failure log here:
https://hydra.nixos.org/build/320731525
The difference between actual and expected is 16k (one page size on
aarch64-darwin).
The test seems brittle as it depends on peak memory, not real memory
at the moment of measurement, so anything during the run of the process
that could push the allocator to allocate another page can break the
test.
This patch switches the test case to measure real memory using psutil on
all platforms.
Signed-off-by: Ihar Hrachyshka ihar.hrachyshka@gmail.com
Proposed changes
Please include a description of the problem or feature this PR is addressing. If there is a corresponding issue, include the issue #.
Checklist
Put an
xin the boxes that apply.pre-commit run --all-filesto format my code / installed pre-commit prior to committing changes