Fix Fiber::LocalData leak for large fiber locals
authorAndrii Grynenko <andrii@fb.com>
Tue, 11 Apr 2017 06:14:38 +0000 (23:14 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 11 Apr 2017 06:19:40 +0000 (23:19 -0700)
Summary: facepaw

Reviewed By: yfeldblum

Differential Revision: D4856227

fbshipit-source-id: 17a73d4d630c6efe1763bbd8aff8b7a2c7721c27

folly/fibers/Fiber.cpp
folly/fibers/Fiber.h

index 39dcc3332983d1bde8e0867d05d53d2d1599c8f9..f5995de31b2a3c5618b68b32425ee652664b8321 100644 (file)
@@ -189,6 +189,10 @@ void Fiber::preempt(State state) {
   }
 }
 
+Fiber::LocalData::~LocalData() {
+  reset();
+}
+
 Fiber::LocalData::LocalData(const LocalData& other) : data_(nullptr) {
   *this = other;
 }
index 0fcd903d164057cef7cc491bafcbd71d5e41997f..36af25ebb0862c2636480c61d96fc7c62c3d4352 100644 (file)
@@ -131,6 +131,7 @@ class Fiber {
   class LocalData {
    public:
     LocalData() {}
+    ~LocalData();
     LocalData(const LocalData& other);
     LocalData& operator=(const LocalData& other);