mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Merge pull request #78126 from andrurogerz/swift-inspect-windows-2
[swift-inspect] stop leaking memory in Windows heap iteration
This commit is contained in:
@@ -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!)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -59,7 +59,7 @@ internal final class WindowsRemoteProcess: RemoteProcess {
|
||||
}
|
||||
}
|
||||
|
||||
static var Free: FreeFunction {
|
||||
static var Free: FreeFunction? {
|
||||
return { (_, bytes, _) in
|
||||
free(UnsafeMutableRawPointer(mutating: bytes))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user