Fix usingJEMalloc with Clang
authorGiuseppe Ottaviano <ott@fb.com>
Thu, 19 Nov 2015 19:39:27 +0000 (11:39 -0800)
committerfacebook-github-bot-9 <folly-bot@fb.com>
Thu, 19 Nov 2015 20:20:28 +0000 (12:20 -0800)
commit78022b6e547c088a585bc7c5d5400978498bacf5
tree8b76018df249b57b6dcf7ec2a00c1a87f6874a23
parent2fa98577f4b73f8a2180fb88b5f075cce6d650e6
Fix usingJEMalloc with Clang

Summary: Clang is too clever and in some contexts optimizes away the `malloc`, but we rely on a side-effect. Declaring the variable as static forces it to call `malloc`. We could free the pointer relying on the fact that the lambda is guaranteed to be called only once, but I feel more comfortable just leaking it (LSan won't complain).

Reviewed By: philippv

Differential Revision: D2674769

fb-gh-sync-id: 1153a3ca226c6b7aa64c453bd61b036dcbf3ffcc
folly/Malloc.h