IndexedMemPool: Fix race condition on size_ that can cause the destructor to access nonexistent slots
Summary:
Contention on allocation when there is exactly one slot remaining can cause size_ to exceed actualCapacity_.
Without taking the min of size_ and actualCapacity_ the destructor may try to destroy out-of-bound slots.
Added a test to test/IndexedMemPoolTest.cpp that failed before the fix and passes after the fix.
Reviewed By: nbronson
Differential Revision:
D4837251
fbshipit-source-id:
a887487727f17eaf2ba66345f40fc91d2fe3bc00