Merge pull request #78126 from andrurogerz/swift-inspect-windows-2

[swift-inspect] stop leaking memory in Windows heap iteration
This commit is contained in:
Saleem Abdulrasool
2024-12-16 09:42:13 -08:00
committed by GitHub
3 changed files with 3 additions and 7 deletions

View File

@@ -86,6 +86,8 @@ internal final class DarwinRemoteProcess: RemoteProcess {
return swift_addr_t(range.location)
}
static var Free: FreeFunction? { return nil }
static var ReadBytes: ReadBytesFunction {
return { (context, address, size, _) in
let process: DarwinRemoteProcess = DarwinRemoteProcess.fromOpaque(context!)

View File

@@ -45,12 +45,6 @@ internal protocol RemoteProcess: AnyObject {
func iterateHeap(_ body: (swift_addr_t, UInt64) -> Void)
}
extension RemoteProcess {
static var Free: FreeFunction? {
return nil
}
}
extension RemoteProcess {
internal func toOpaqueRef() -> UnsafeMutableRawPointer {
return Unmanaged.passRetained(self).toOpaque()

View File

@@ -59,7 +59,7 @@ internal final class WindowsRemoteProcess: RemoteProcess {
}
}
static var Free: FreeFunction {
static var Free: FreeFunction? {
return { (_, bytes, _) in
free(UnsafeMutableRawPointer(mutating: bytes))
}