Re: Binary Size Impact of Enabling Sized Deallocation in PartitionAlloc

16 views
Skip to first unread message

Stephen Nusko

unread,
Nov 18, 2025, 11:22:05 PM11/18/25
to Ayumi Ono, binar...@chromium.org, le...@google.com, chrome-m...@google.com, chrome-mem...@google.com, Hans Wennborg
Once more, apparently you have to be a member :)

On Tue, Nov 18, 2025 at 10:19 PM Stephen Nusko <nus...@google.com> wrote:
+binar...@chromium.org, Apparently interns can't email non @google.com accounts (even chromium.org ones) without an exception. So re-adding this mailing list in until we fix that.

On Tue, Nov 18, 2025 at 9:34 PM Ayumi Ono <ayum...@google.com> wrote:

TL;DR; Chrome’s PartitionAllocis working on enabling sized deallocation. We’ve found large binary size increases and would like to ask lexan folks if clang is configured correctly (we see some strange additional assembly instructions), and binary-size folks if they have ideas to reduce the size further or if we could accept the binary hit for different platforms. Context below.

Feature: Sized Deallocation

  • Currently on asan builds we have enabled sized deallocation by removing the -fno-sized-deallocation compiler flag, which allows the compiler to use operator delete(void* ptr, size_t size).

  • In PartitionAlloc, these calls are redirected via ShimCppDeleteWithSize to our custom FreeWithSize function.

  • FreeWithSize is implemented to directly utilize the provided size argument for deallocation logic (e.g., calculating bucket_index), instead of needing to read metadata from the allocated pointer.

Observed Android Binary Size Increase:

CL Patch 18 (where we enabled it on all platforms):

The binary increase is distributed across files.


Our Efforts to Mitigate Size Increase:

We have already worked on reducing binary size in related areas. For instance, removing unnecessary templates and lambdas in our code reduced the Fuchsia compressed binary size by approximately one system page (8KB). 

We also suspect that a lot of this will just be clang generated code passing the size parameter to the delete operator which will be spread out throughout the code base and difficult to reduce. For example, the angle disassemble results show an increase of approximately 6-8 instructions per delete operator call. This increase includes _LIBCPP_ASAN_VOLATILE_WRAPPER and __endian_factor, which to us are unexpected (especially since asan is not enabled).

Future Uses of Sized Deallocation:

Despite the size increase, enabling sized deallocation unlocks several capabilities (non-exhaustive list):

  • Improved ThreadCache Performance Experiments: We can run Finch performance experiments for ThreadCache by leveraging the size information. Note TCMalloc has found 1% fleet cycles savings and 3-5% for memory heavy applications.

  • Out-of-Bounds Write Detection: The known allocation size allows us to implement high performance detectors for out-of-bounds writes.

Questions:

  1. For both Lexan and binary-size folks: Are there any further strategies, our internal implementation, or linker optimizations that would mitigate this size increase?

  2. For Lexan folks: Is there any way to prevent _LIBCPP_ASAN_VOLATILE_WRAPPER and so on being added by clang in delete operator calls. 

  3. For binary-size folks: Considering the benefits of sized deallocation, is the observed binary size increase acceptable for Chrome on Android, and Fuchsia?

  4. For binary-size folks: Also for other platforms less sensitive to binary size would this be okay to enable for the experiment?

--
You received this message because you are subscribed to the Google Groups "chrome-memory-tok" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-memory-...@google.com.
To view this discussion visit https://groups.google.com/a/google.com/d/msgid/chrome-memory-tok/CAHJiW_bkGrygRAYfeJuB0zDOWw1BJLxxC8w9M%3Drmp-eS%3DM5Ygw%40mail.gmail.com.
For more options, visit https://groups.google.com/a/google.com/d/optout.

Stephen Nusko

unread,
Nov 18, 2025, 11:41:03 PM11/18/25
to binary-size, Stephen Nusko, Hans Wennborg, Ayumi Ono, Mikihito Matsuura
-@google.com mailing lists, apparently you can't post to them from your chromium account even if it is tied. So forking into two separate threads. Sorry for the noise.
To unsubscribe from this group and stop receiving emails from it, send an email to chrome-memory-tok+unsubscribe@google.com.

Andrew Grieve

unread,
Nov 19, 2025, 9:51:17 AM11/19/25
to Stephen Nusko, binary-size, Hans Wennborg, Ayumi Ono, Mikihito Matsuura
The arm64 size result shows 4mb increase. Now, this size result has been known to be wildly off due to arm64's sensitivity to PGO. Probably the way to check is to land it and wait a couple of days and then compary canary build sizes.

Sounds like we should disable it when "optimize_for_size=true". This is true on arm32, but arm32 represents a dwindling number of devices, so it's not really a thing to care about.

To unsubscribe from this group and stop receiving emails from it, send an email to chrome-memory-...@google.com.

--
You received this message because you are subscribed to the Google Groups "binary-size" group.
To unsubscribe from this group and stop receiving emails from it, send an email to binary-size...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/binary-size/158f2339-75ab-449c-9b45-cd0873bcd08cn%40chromium.org.

Stephen Nusko

unread,
Nov 19, 2025, 6:16:37 PM11/19/25
to binary-size, Andrew Grieve, binary-size, Hans Wennborg, ayum...@google.com, Mikihito Matsuura, Stephen Nusko
Thanks Andrew,

`optimize_for_size` seems like a relevant gn arg indeed, do you know if Fuchsia would be opt-d out for that as well?

Wow didn't notice the 4MB for arm64... I'm glad that it is wildly off sometimes? Guess we can see based on Canary version as you suggest. Is there a doc or dashboard to check after we submit it?

No concerns launching this for all platforms that don't set `optimize_for_size=true`?

To unsubscribe from this group and stop receiving emails from it, send an email to chrome-memory-tok+unsubscribe@google.com.

--
You received this message because you are subscribed to the Google Groups "binary-size" group.
To unsubscribe from this group and stop receiving emails from it, send an email to binary-size+unsubscribe@chromium.org.

Andrew Grieve

unread,
Nov 19, 2025, 6:43:45 PM11/19/25
to Stephen Nusko, binary-size, Andrew Grieve, Hans Wennborg, ayum...@google.com, Mikihito Matsuura
I believe Fuschia does use optimize_for_size=true, so this would opt them out.

go/chrome-supersize is a quick way to check canary sizes. Use high-arm_65/TrichromeGoogle6432

To unsubscribe from this group and stop receiving emails from it, send an email to chrome-memory-...@google.com.

--
You received this message because you are subscribed to the Google Groups "binary-size" group.
To unsubscribe from this group and stop receiving emails from it, send an email to binary-size...@chromium.org.

Stephen Nusko

unread,
Dec 8, 2025, 9:32:04 PM12/8/25
to Andrew Grieve, Stephen Nusko, binary-size, ayum...@google.com, Mikihito Matsuura

Sharing the results from Ayumi from the google thread back to the chromium ones as well, in case you have any concerns Andrew with us proceeding.


Thank you all,
I have some results to share regarding the 'size_delete' enablement using TrichromeGoogle6432, based on your suggestion. The CL landed in Canary with version 144.0.7557.0.
  • From 144.0.7556.0 to 144.0.7557.0, there was a +4.4 MiB increase in binary size. This increase is distributed across component, content, and third_party. (supersize diff)
  • However, with the update from 144.0.7557.0 to 144.0.7558.0, possibly due to the effects of PGO, the overall binary size decreased by -3.2 MiB. (supersize diff)
  • As a result, the net binary size increase from 144.0.7556.0 to 144.0.7558.0 is limited to +1.2 MiB (supersize diff). The distribution of the increase remains scattered across the aforementioned components.

Cheers,
Stephen 

Andrew Grieve

unread,
Dec 9, 2025, 10:43:30 AM12/9/25
to Stephen Nusko, Andrew Grieve, binary-size, ayum...@google.com, Mikihito Matsuura
+1.2mb is still quite big, but as long as it provides a clear benefit, and is easy to turn on / off, then we can go ahead and revisit if there is a need to reduce our footprint in the future.
Reply all
Reply to author
Forward
0 new messages