Use weak_ptr to hold future context in timekeeper to allow clean up when future complete
authorRichard Meng <richmeng@fb.com>
Tue, 29 Aug 2017 17:18:29 +0000 (10:18 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Tue, 29 Aug 2017 17:20:47 +0000 (10:20 -0700)
commitc02d603390a8ece8e5378d92f3971955667426db
tree599128cd71984d02a467f016c3c97ada23f165bb
parentecba6a15740be358f327e3dbba8dfb1eb73ce66c
Use weak_ptr to hold future context in timekeeper to allow clean up when future complete

Summary:
Before this change, future context will not be cleaned up until timekeeper times out. These objects has been occupying memory when more shorter future tasks are registered.
Switch to use weak ptr to hold context, so that context objects are deallocated as soon as the future completes (or times out)

Reviewed By: yfeldblum

Differential Revision: D5692040

fbshipit-source-id: b3b74a29b2ccafef6c4a06011699b069feb3a847
folly/futures/Future-inl.h
folly/futures/test/FutureTest.cpp