From: Yuri Putivsky Date: Fri, 29 Jul 2016 02:19:25 +0000 (-0700) Subject: takeOwnershipOfPipes method releases memory X-Git-Tag: v2016.07.29.00~4 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=ff76c3292a2c6858e02ed20d756fa0e0a998a4a0;p=folly.git takeOwnershipOfPipes method releases memory Summary: takeOwnershipOfPipes should left zero heap memory allocated in folly:Subprocess class instance. Reviewed By: snarkmaster Differential Revision: D3638503 fbshipit-source-id: aac7b10bd7399c44868f32c01164f4123892598f --- diff --git a/folly/Subprocess.cpp b/folly/Subprocess.cpp index 1e294ba7..d7d28d9f 100644 --- a/folly/Subprocess.cpp +++ b/folly/Subprocess.cpp @@ -832,7 +832,8 @@ std::vector Subprocess::takeOwnershipOfPipes() { for (auto& p : pipes_) { pipes.emplace_back(p.childFd, std::move(p.pipe)); } - pipes_.clear(); + // release memory + std::vector().swap(pipes_); return pipes; }