Skip to content

[Runtime] Don't cache malloc_default_zone. #66305

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
merged 1 commit into from
Jun 7, 2023

Conversation

mikeash
Copy link
Contributor

@mikeash mikeash commented Jun 2, 2023

Caching the default zone should no longer be necessary.

rdar://102870625

@mikeash mikeash requested review from yln, kubamracek and Catfish-Man June 2, 2023 20:21
Copy link
Contributor

@Catfish-Man Catfish-Man left a comment

Choose a reason for hiding this comment

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

Seems fine

@mikeash
Copy link
Contributor Author

mikeash commented Jun 2, 2023

@swift-ci please test and merge

@mikeash
Copy link
Contributor Author

mikeash commented Jun 6, 2023

@swift-ci please test macos platform

@yln
Copy link
Contributor

yln commented Jun 6, 2023

I like this!

} else {
size_t alignment = computeAlignment(alignMask);
p = malloc_type_zone_memalign(DEFAULT_ZONE(), alignment, size, typeId);
malloc_type_memalign(&p, alignment, size, typeId);
Copy link
Contributor

@yln yln Jun 6, 2023

Choose a reason for hiding this comment

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

Nit: use malloc_type_aligned_alloc to avoid memalign's awkward interface (out parameter) and the need to initialize p (which makes it different from the original swift_slowAlloc function above).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh nice, I was looking for “memalign” specifically and missed that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

And fixed.

Caching the default zone should no longer be necessary.

rdar://102870625
@mikeash mikeash force-pushed the dont-cache-malloc-default-zone branch from 3c0dec3 to 007ac9a Compare June 7, 2023 01:25
@mikeash
Copy link
Contributor Author

mikeash commented Jun 7, 2023

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit e4debda into swiftlang:main Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants