Skip to content

Commit 1fb84bb

Browse files
authored
Merge pull request swiftlang#78126 from andrurogerz/swift-inspect-windows-2
[swift-inspect] stop leaking memory in Windows heap iteration
2 parents 7aed593 + f6b1fca commit 1fb84bb

File tree

3 files changed

+3
-7
lines changed

3 files changed

+3
-7
lines changed

tools/swift-inspect/Sources/swift-inspect/DarwinRemoteProcess.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ internal final class DarwinRemoteProcess: RemoteProcess {
8686
return swift_addr_t(range.location)
8787
}
8888

89+
static var Free: FreeFunction? { return nil }
90+
8991
static var ReadBytes: ReadBytesFunction {
9092
return { (context, address, size, _) in
9193
let process: DarwinRemoteProcess = DarwinRemoteProcess.fromOpaque(context!)

tools/swift-inspect/Sources/swift-inspect/RemoteProcess.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,6 @@ internal protocol RemoteProcess: AnyObject {
4545
func iterateHeap(_ body: (swift_addr_t, UInt64) -> Void)
4646
}
4747

48-
extension RemoteProcess {
49-
static var Free: FreeFunction? {
50-
return nil
51-
}
52-
}
53-
5448
extension RemoteProcess {
5549
internal func toOpaqueRef() -> UnsafeMutableRawPointer {
5650
return Unmanaged.passRetained(self).toOpaque()

tools/swift-inspect/Sources/swift-inspect/WindowsRemoteProcess.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ internal final class WindowsRemoteProcess: RemoteProcess {
5959
}
6060
}
6161

62-
static var Free: FreeFunction {
62+
static var Free: FreeFunction? {
6363
return { (_, bytes, _) in
6464
free(UnsafeMutableRawPointer(mutating: bytes))
6565
}

0 commit comments

Comments
 (0)