Call onRecycle after element is marked as deallocated in IndexedMemPool
authorVictor Zverovich <viz@fb.com>
Wed, 21 Jun 2017 18:38:32 +0000 (11:38 -0700)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 21 Jun 2017 18:42:36 +0000 (11:42 -0700)
commit15884e47719c8b4e5f3c5ea51f50aebb46887611
tree59e22e2ec30278f944f5b9ef840a05081874c47d
parent51e345da33505616db9804d98145a33f5eaf930c
Call onRecycle after element is marked as deallocated in IndexedMemPool

Summary: Make `IndexedMemPool` call `Traits::onRecycle` on the element just before it is marked as deallocated. This mirrors the allocation behavior implemented in D5177462 and simplifies preventing access to recycled elements (the client just needs to check `isAllocated` before accessing the element).

Reviewed By: nbronson

Differential Revision: D5275283

fbshipit-source-id: 58365b5b7b32b07fa56529c476078f241fc20811
folly/IndexedMemPool.h
folly/test/IndexedMemPoolTest.cpp