IndexedMemPool - pool allocator tailored for lock-free data structures
authorNathan Bronson <ngbronson@fb.com>
Wed, 15 Jan 2014 23:15:31 +0000 (15:15 -0800)
committerJordan DeLong <jdelong@fb.com>
Thu, 16 Jan 2014 19:21:42 +0000 (11:21 -0800)
commitdf7a2f8103818afb0f76654073f1505e83539c96
treed0f9126026bad41e96ec3980af1f1f4a28d160ef
parentf41fd6f718fb39b617bbdbc6af0e34f3eae5e381
IndexedMemPool - pool allocator tailored for lock-free data structures

Summary:
Instances of IndexedMemPool dynamically allocate and then pool
their element type (T), returning 4-byte integer indices that can be
passed to the pool's operator[] method to access or obtain pointers to
the actual elements.  Once they are constructed, elements are never
destroyed.  These two features are useful for lock-free algorithms.
The indexing behavior makes it easy to build tagged pointer-like-things,
since a large number of elements can be managed using fewer bits than a
full pointer.  The pooling behavior makes it safe to read from T-s even
after they have been recycled

Test Plan:
1. unit tests
2. unit tests using DeterministicSchedule
3. this code is moved from tao/queues where it is in production use

Reviewed By: davejwatson@fb.com

FB internal diff: D1089053
folly/IndexedMemPool.h [new file with mode: 0644]
folly/Makefile.am
folly/test/IndexedMemPoolTest.cpp [new file with mode: 0644]