You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@jckarter well, kind of a dup. It would certainly be possible to implement DispatchData.copyBytes without using any closures. But fixing SR-904 would obviously be the most awesome fix and it would fix so many other similarly surprising issues too.
@jckarter don't get me wrong, I would love for SR-904 to be fixed. I didn't file it as a dupe because I wan't sure if SR-904 will be fixed soon and I still think that DispatchData must be able to copy the bytes out of itself without allocating, regardless of Swift's ability to allocate non-escaping closures on the heap. But if fixing SR-904 is the fix to this bug I'll be very very happy 🙂
Additional Detail from JIRA
md5: 63ced7a174d79c5fd0d6f317c1e088e1
Issue Description:
every method I can see to copy bytes out of a DispatchData into some other container of bytes allocates.
DispatchData.copyBytes looks really benign but internally calls (https://github.com/apple/swift-corelibs-libdispatch/blob/9c48a809693b78bd5ad89718c6f9712aaa1cfb1e/src/swift/Data.swift#L221) _copyBytesHelper which calls CDispatch.dispatch_data_apply which needs a closure. That closure has a non-nil context pointer and therefore allocates.
Possible solutions:
fix SR-904
make enough things inlinable/usableFromInline that we don't actually need to create a proper closure
CC @jckarter, phabouzit (JIRA User), @phausler, @parkera, phabouzit (JIRA User)
The text was updated successfully, but these errors were encountered: