Skip to content

Sema: leak rather than corrupt memory #68267

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

Closed
wants to merge 2 commits into from

Conversation

compnerd
Copy link
Member

@compnerd compnerd commented Sep 1, 2023

UnsafeMutableBufferPointer.allocate does not guarantee usage of malloc (and in fact guarantees the opposite due to alignment assumptions). The memory allocated by that must be released by UnsafeMutableBufferPointer.deallocate only as that is guaranteed to correctly call the deallocation routine. Leak memory rather than corrupting memory.

`UnsafeMutableBufferPointer.allocate` does not guarantee usage of
`malloc` (and in fact guarantees the opposite due to alignment
assumptions).  The memory allocated by that must be released by
`UnsafeMutableBufferPointer.deallocate` only as that is guaranteed to
correctly call the deallocation routine.  Leak memory rather than
corrupting memory.
@compnerd
Copy link
Member Author

compnerd commented Sep 1, 2023

CC: @DougGregor @rintaro @bnbarham

Remove more cross-domain frees.
@compnerd compnerd mentioned this pull request Sep 1, 2023
9 tasks
@DougGregor
Copy link
Member

This should be subsumed by #68271

@DougGregor DougGregor closed this Sep 1, 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.

2 participants