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

Don't use auto-release pool in string-related methods #218

Open
kvark opened this issue Oct 19, 2021 · 0 comments
Open

Don't use auto-release pool in string-related methods #218

kvark opened this issue Oct 19, 2021 · 0 comments

Comments

@kvark
Copy link
Member

kvark commented Oct 19, 2021

We have set_label methods, which use nsstring_from_str, which uses auto-release pool. This is inviting for leaks in user code. There is no reason why set_label should use any auto-release pools, technically.

Proposal - split nsstring_as_str into separate methods for creation of an NSString and borrowing it as str. This way, the calling code is responsible for freeing it when needed. don't autorelease NSString. Instead, return an object that the caller can free explicitly by dropping. The caller is our own method in this case, so we can ensure the lifetime is correct.

xiaopengli89 added a commit to xiaopengli89/wgpu that referenced this issue Oct 20, 2021
kvark pushed a commit to gfx-rs/wgpu that referenced this issue Oct 20, 2021
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS

* Don't wrap autoreleasepool when blit command encoder is already active

* Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
kvark pushed a commit to kvark/wgpu that referenced this issue Oct 22, 2021
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS

* Don't wrap autoreleasepool when blit command encoder is already active

* Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
kvark pushed a commit to gfx-rs/wgpu that referenced this issue Oct 22, 2021
* Fix memory RenderCommandEncoder, BlitCommandEncoder, label leak on macOS

* Don't wrap autoreleasepool when blit command encoder is already active

* Revert wrap set_label, instead focus on gfx-rs/metal-rs#218
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant