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

[SR-9926] Captured objects are not released when adding operation with block to OperationQueue #3537

Closed
swift-ci opened this issue Feb 14, 2019 · 3 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-9926
Radar rdar://problem/48072539
Original Reporter sisoje (JIRA User)
Type Bug
Status Resolved
Resolution Cannot Reproduce
Environment

XCode 10.1/10.2

Swift 4.2/5.0 (same happens with Objective-C)

IOS Simulator, iPhone XR

Additional Detail from JIRA
Votes 0
Component/s Foundation
Labels Bug
Assignee None
Priority Medium

md5: 015772b4cd62c86b53f46b4fa2db8c56

Issue Description:

Captured objects are not released when adding operation with block to OperationQueue.

I created an unit test to show the problem here:

https://gist.github.com/sisoje/4a73e36ffbe917a25d14deacd814bfc9

Interesting to note:

  • adding async block to DispatchQueue works fine

  • adding BlockOperation to OperationQueue works fine

@belkadan
Copy link

Yikes! cc @millenomi

@millenomi
Copy link
Contributor

See the comment in your gist at https://gist.github.com/sisoje/4a73e36ffbe917a25d14deacd814bfc9#file-testfulfill-swift-L48 — you're asserting that an object is still alive or not, but you're doing so without emptying the autorelease pool on Darwin.

@swift-ci
Copy link
Contributor Author

Comment by Lazar Otasevic (JIRA)

@millenomi i saw it, wrapping "add operation with block" with autoreleasepool { ... } prevents this error, thanks

Also thanks to @belkadan for commenting this ticket 🙂

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
This issue was closed.
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

3 participants