Skip to content

Conversation

@3405691582
Copy link
Contributor

ManagedBuffer.capacity depends on malloc introspection (e.g., malloc_size), which is not available on this platform -- and is thus marked as such.

Here, _HashNode.Storage is a ManagedBuffer. Thankfully, the uses of .capacity are fairly limited: one for statistic purposes, which we just completely omit on the platform, and the other, setting a minimum capacity in the header by the buffer's .capacity; the alternative being setting that minimum capacity directly.

Checklist

  • I've read the Contribution Guidelines
  • My contributions are licensed under the Swift license.
  • I've followed the coding style of the rest of the project.
  • I've added tests covering all new code paths my change adds to the project (if appropriate). n/a: no new code paths, just refactoring
  • I've added benchmarks covering new functionality (if appropriate). n/a: no new functionality
  • I've verified that my change does not break any existing tests or introduce unexplained benchmark regressions. having difficulty running tests myself, will use CI if possible
  • I've updated the documentation if necessary. no documentation changes necessary

ManagedBuffer.capacity depends on malloc introspection (e.g.,
`malloc_size`), which is not available on this platform -- and is thus
marked as such.

Here, _HashNode.Storage is a ManagedBuffer. Thankfully, the uses of
.capacity are fairly limited: one for statistic purposes, which we just
completely omit on the platform, and the other, setting a minimum
capacity in the header by the buffer's .capacity; the alternative being
setting that minimum capacity directly.
@3405691582 3405691582 requested a review from lorentey as a code owner March 29, 2025 17:37
@3405691582
Copy link
Contributor Author

@swift-ci please test.

@lorentey lorentey added this to the 1.2.0 milestone Apr 17, 2025
Copy link
Member

@lorentey lorentey left a comment

Choose a reason for hiding this comment

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

Thanks! I noted a small adjustment we should make on all platforms.

@3405691582
Copy link
Contributor Author

@swift-ci please test.

@3405691582
Copy link
Contributor Author

Applied your suggestion. Please merge on my behalf if there's nothing else, thanks!

@3405691582
Copy link
Contributor Author

@lorentey ping on the merge if that's OK :)

@3405691582
Copy link
Contributor Author

@lorentey ping again on merging, if there's nothing else, thank you!

@lorentey lorentey merged commit e63f444 into apple:main May 15, 2025
23 checks passed
@lorentey
Copy link
Member

I'll cherry pick this to the release/1.2 branch, in a separate (bulk) PR

@lorentey lorentey added the HashTreeCollections Hash-array mapped prefix tree implementations label May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

HashTreeCollections Hash-array mapped prefix tree implementations

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants