D'oh: fix size computation in ThreadLocalDetail.h
[folly.git] / folly / detail / ThreadLocalDetail.h
index 1d8fc7aae39b592d296eda4652d631bca4f1c1b4..de3ebb8a5f957d7efbbf8f8e2133c0be1b1a8ff0 100644 (file)
@@ -271,8 +271,8 @@ struct StaticMeta {
           prevSize < jemallocMinInPlaceExpandable ||
           (rallocm(
               static_cast<void**>(static_cast<void*>(&threadEntry_.elements)),
-              NULL, newSize, 0, ALLOCM_NO_MOVE | ALLOCM_ZERO) !=
-           ALLOCM_SUCCESS)) {
+              NULL, newSize * sizeof(ElementWrapper), 0,
+              ALLOCM_NO_MOVE | ALLOCM_ZERO) != ALLOCM_SUCCESS)) {
         // Sigh, must realloc, but we can't call realloc here, as elements is
         // still linked in meta, so another thread might access invalid memory
         // after realloc succeeds.  We'll copy by hand and update threadEntry_