Skip to content

Commit e6e174c

Browse files
authored
Merge pull request #76623 from swiftlang/revert-76595-wip-release-dist-execute-return
Revert "[Distributed] remote calls over-retain returned values"
2 parents 8c4e7d2 + 9779137 commit e6e174c

File tree

3 files changed

+5
-130
lines changed

3 files changed

+5
-130
lines changed

stdlib/public/Distributed/DistributedActorSystem.swift

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -531,8 +531,8 @@ extension DistributedActorSystem {
531531
}
532532

533533
// Decode the return type
534-
func allocateReturnTypeBuffer<R>(_: R.Type) -> UnsafeMutableRawPointer? {
535-
return UnsafeMutableRawPointer(UnsafeMutablePointer<R>.allocate(capacity: 1))
534+
func allocateReturnTypeBuffer<R>(_: R.Type) -> UnsafeRawPointer? {
535+
return UnsafeRawPointer(UnsafeMutablePointer<R>.allocate(capacity: 1))
536536
}
537537

538538
let maybeReturnTypeFromTypeInfo =
@@ -555,14 +555,12 @@ extension DistributedActorSystem {
555555
errorCode: .typeDeserializationFailure)
556556
}
557557

558-
func doDestroyReturnTypeBuffer<R>(_: R.Type) {
559-
let buf = resultBuffer.assumingMemoryBound(to: R.self)
560-
buf.deinitialize(count: 1)
561-
buf.deallocate()
558+
func destroyReturnTypeBuffer<R>(_: R.Type) {
559+
resultBuffer.assumingMemoryBound(to: R.self).deallocate()
562560
}
563561

564562
defer {
565-
_openExistential(returnTypeFromTypeInfo, do: doDestroyReturnTypeBuffer)
563+
_openExistential(returnTypeFromTypeInfo, do: destroyReturnTypeBuffer)
566564
}
567565

568566
do {

test/Distributed/Inputs/FakeDistributedActorSystems.swift

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,6 @@ public final class FakeRoundtripActorSystem: DistributedActorSystem, @unchecked
324324
handler: resultHandler
325325
)
326326

327-
defer { remoteCallResult = nil }
328-
defer { remoteCallError = nil }
329327
switch (remoteCallResult, remoteCallError) {
330328
case (.some(let value), nil):
331329
print(" << remoteCall return: \(value)")

test/Distributed/Runtime/distributed_actor_execute_doesnt_leak_return.swift

Lines changed: 0 additions & 121 deletions
This file was deleted.

0 commit comments

Comments
 (0)