Hi John, I've been doing some more digging into this. While I haven't been able to find a fix yet, I have some questions.
I was able to get a closer look at what I believe is the closure context for the closure that I'm storing in a box. It was a swift::metadataimpl::SwiftRetainableBox wrapped HeapObject and I confirmed that swift_release is indeed being called on the underlying HeapObject.
However, what I found weird was that the strong ref count of this HeapObject was 1, both before and after the swift_release call. I got a dump for the object before and after the swift_release call -
// Before
HeapObject: 0x100d04450
HeapMetadata Pointer: 0x100004368.
Strong Ref Count: 1.
Unowned Ref Count: 1.
Weak Ref Count: 1.
Uses Native Retain: Not a class. N/A.
RefCount Side Table: 0x0.
Is Deiniting: false.
// After
HeapObject: 0x100d04450
HeapMetadata Pointer: 0x0.
Strong Ref Count: 1.
Unowned Ref Count: 0.
Weak Ref Count: 0.
// Rest didn't print due to seg faulting
Is this expected?