From f05803b20b6701b76abcd923764565121a1c0535 Mon Sep 17 00:00:00 2001 From: Tudor Bosman Date: Fri, 8 Jun 2012 21:30:50 -0700 Subject: [PATCH] D'oh: fix size computation in ThreadLocalDetail.h Test Plan: thread_local_test Reviewed By: ldemailly@fb.com FB internal diff: D490912 --- folly/detail/ThreadLocalDetail.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/folly/detail/ThreadLocalDetail.h b/folly/detail/ThreadLocalDetail.h index 1d8fc7aa..de3ebb8a 100644 --- a/folly/detail/ThreadLocalDetail.h +++ b/folly/detail/ThreadLocalDetail.h @@ -271,8 +271,8 @@ struct StaticMeta { prevSize < jemallocMinInPlaceExpandable || (rallocm( static_cast(static_cast(&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_ -- 2.34.1