Skip to content
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

Add future wait benchmark to catch memory leaks #2931

Merged
merged 4 commits into from
Oct 17, 2024

Conversation

rnro
Copy link
Contributor

@rnro rnro commented Oct 17, 2024

Motivation:

In the past we introduced a memory leak around the creation of and waiting on futures - we should protect against leaks in this fundamental operation.

Modifications:

Add a new benchmark which would have failed with the previous bug

Result:

Regression protection for this type of memory leak.

Motivation:

In the past we introduced a memory leak around the creation of and
waiting on futures - we should protect against leaks in this fundamental
operation.

Modifications:

Add a new benchmark which would have failed with the previous bug

Result:

Regression protection for this type of memory leak.
@rnro rnro added the semver/patch No public API change. label Oct 17, 2024
@Lukasa Lukasa merged commit 06c16b1 into apple:main Oct 17, 2024
30 of 31 checks passed
Comment on lines +24 to +27
let leakMetrics: [BenchmarkMetric] = [
.mallocCountTotal,
.memoryLeaked,
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to add one comment here. Should we add leaks to all of our benchmarks. Seems like we had that before in the old school alloc tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe. Unfortunately it seems like there isn't a simple "detect leaks" lever to pull here. Even in a case where I manufactured a leak I had to tweak the configuration carefully to have it detected. We could copy that configuration and hope it would detect any leak but doing so would slow down the benchmarks significantly. I'm planning on investigating jemalloc in more detail to see if we can do anything to make leak detection more robust.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants