[Lldb-commits] [lldb] [lldb] address memory leakage in lldb-server (PR #177572)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 19 02:20:30 PST 2026


================
@@ -56,12 +56,15 @@ MonitoringProcessLauncher::LaunchProcess(const ProcessLaunchInfo &launch_info,
     assert(launch_info.GetMonitorProcessCallback());
     llvm::Expected<HostThread> maybe_thread =
         process.StartMonitoring(launch_info.GetMonitorProcessCallback());
-    if (!maybe_thread)
+    if (!maybe_thread) {
       error = Status::FromErrorStringWithFormatv(
           "failed to launch host thread: {}",
           llvm::toString(maybe_thread.takeError()));
-    if (log)
-      log->PutCString("started monitoring child process.");
+    } else {
+      if (log)
+        log->PutCString("started monitoring child process.");
+      maybe_thread->Reset();
----------------
DavidSpickett wrote:

This isn't your fault but Reset seems like a surprising thing to call here. Please add a comment describing the intent, perhaps:
```
// Allow the thread to exit on its own once its work is done.
```
To make the point that Reset doesn't kill the thread, just clears lldb's wrapper around the OS thread.

https://github.com/llvm/llvm-project/pull/177572


More information about the lldb-commits mailing list