Fix bad bug in folly::ThreadLocal
authorTudor Bosman <tudorb@fb.com>
Fri, 27 Sep 2013 00:19:24 +0000 (17:19 -0700)
committerPeter Griess <pgriess@fb.com>
Tue, 15 Oct 2013 01:44:12 +0000 (18:44 -0700)
commit762965ce25c73623845d3075111b565421dcc608
tree1e6b89065df06b7f7f5e06ed8ea3a8f08f937c2f
parent6d372314d3e25a9193bdcde212edd315ad390e6a
Fix bad bug in folly::ThreadLocal

Summary:
There were a few bugs, actually:

1. prevSize < jemallocMinInPlaceExpandable compared an element count with
a byte size; this hid the next bug for a while (as we needed 4096
ThreadLocalPtr objects in order to trigger it)

2. if rallocm(... ALLOCM_NO_MOVE) succeeds in expanding in place, we don't
increment elementsCapacity_, which is bad.

Switched to allocm() so we always take advantage of all memory that was
actually allocated.

@override-unit-failures
Clearly unrelated
+Warning: This development build of composer is over 30 days old. It
is recommended to update it by running
"hphp/test/slow/ext_phar/composer.php self-update" to get the latest
version.

Test Plan: test added, which failed before and doesn't any more

Reviewed By: lucian@fb.com

FB internal diff: D987009
folly/ThreadCachedInt.h
folly/ThreadLocal.h
folly/detail/ThreadLocalDetail.h
folly/test/AtomicHashArrayTest.cpp
folly/test/ThreadCachedArenaTest.cpp
folly/test/ThreadLocalTest.cpp