message: global_heap: big honking lock around freeFor
diff: @@ -58,12 +58,15 @@ void GlobalHeap::freeFor(MiniHeap *mh, void *ptr) {
  return;
  }
  + bool shouldConsiderMesh = 0;
  + {
  + lock_guard<mutex> lock(_miniheapLock);
  +
  // large objects are tracked with a miniheap per object and don't
  // trigger meshing, because they are multiples of the page size.
  // This can also include, for example, single page allocations w/
  // 16KB alignment.
  if (mh->maxCount() == 1) {
  - lock_guard<mutex> lock(_miniheapLock);
  freeMiniheapLocked(mh, false);
  return;
  }
  @@ -77,14 +80,13 @@ void GlobalHeap::freeFor(MiniHeap *mh, void *ptr) {
  // our MiniHeap was meshed out from underneath us. Grab the
  // global lock to synchronize with a concurrent mesh, and
  // re-update the bitmap
  - lock_guard<mutex> lock(_miniheapLock);
  mh = miniheapForLocked(ptr);
  hard_assert(!mh->isMeshed());
  mh->free(arenaBegin(), ptr);
  }
  const auto remaining = mh->inUseCount();
  - const bool shouldConsiderMesh = remaining > 0;
  + shouldConsiderMesh = remaining > 0;
  const auto sizeClass = mh->sizeClass();
  @@ -94,9 +96,9 @@ void GlobalHeap::freeFor(MiniHeap *mh, void *ptr) {
  mh = nullptr;
  if (unlikely(shouldFlush)) {
  - lock_guard<mutex> lock(_miniheapLock);
  flushBinLocked(sizeClass);
  }
  + }
  if (shouldConsiderMesh) {
  maybeMesh();
  