Skip to content

Commit

Permalink
base/allocator: Allow one more static initializer for macOS
Browse files Browse the repository at this point in the history
When PartitionAlloc-Everywhere gets enabled for macOS, PA-E uses
a static initializer (InitializeDefaultMallocZoneWithPartitionAlloc),
so increase the limit of number of static initializers by one.

We're aware that the static initializer shouldn't be the best option
to install our own malloc zone.  However, in order to unblock
MiraclePtr project, we decided to go this way as a temporary solution.

Pros/cons of the static initializer, other possible options, etc.
were discussed offline, and the discussion is summarized at:
https://docs.google.com/document/d/1qpEIeqk3whkwOXcKfpwVafJu859vFmMh75XJdbCo6vs/edit?usp=sharing

We'll improve the interception mechanism in the future.  Especially,
ParitionAlloc library (as a standalone library) is promising and
on-going.

Change-Id: I73a8fdd36dcac65466419824437e59aa7d2579d5
Bug: 1121427
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3143794
Commit-Queue: Yuki Shiino <[email protected]>
Reviewed-by: Bartek Nowierski <[email protected]>
Reviewed-by: Nico Weber <[email protected]>
Reviewed-by: Benoit L <[email protected]>
Cr-Commit-Position: refs/heads/main@{#932521}
  • Loading branch information
yuki3 authored and Chromium LUCI CQ committed Oct 18, 2021
1 parent 797e5cc commit bba574c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions testing/scripts/check_static_initializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,12 @@

# Two static initializers are needed on Mac for libc++ to set up
# std::cin/cout/cerr before main() runs. Only iostream.cpp needs to be counted
# here.
FALLBACK_EXPECTED_MAC_SI_COUNT = 2
# here. Plus, PartitionAlloc-Everywhere uses one static initializer
# (InitializeDefaultMallocZoneWithPartitionAlloc) to install a malloc zone.
FALLBACK_EXPECTED_MAC_SI_COUNT = 3

# For coverage builds, also allow 'IntrProfilingRuntime.cpp'
COVERAGE_BUILD_FALLBACK_EXPECTED_MAC_SI_COUNT = 3
COVERAGE_BUILD_FALLBACK_EXPECTED_MAC_SI_COUNT = 4


def run_process(command):
Expand Down

0 comments on commit bba574c

Please sign in to comment.